Submission #1444449
Source Code Expand
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(),(x).end() #define LL long long using namespace std; int main(){ int A,B; cin>>A>>B; int a[A]; int b[B]; REP(i,A)cin>>a[i]; REP(i,B)cin>>b[i]; int sum[A+1][B+1]; int dp[A+1][B+1]; fill(sum[0],sum[A+1],0); fill(dp[0],dp[A+1],0); REP(i,A+1){ if(i>0)sum[i][0]=sum[i-1][0]+a[A-i]; REP(j,B+1){ if(j>0)sum[i][j]=sum[i][j-1]+b[B-j]; if(i>0)dp[i][j]=sum[i][j]-dp[i-1][j]; if(j>0)dp[i][j]=max(dp[i][j],sum[i][j]-dp[i][j-1]); } } cout<<dp[A][B]<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - ゲーム |
User | inmir |
Language | C++14 (GCC 5.4.1) |
Score | 3 |
Code Size | 701 Byte |
Status | AC |
Exec Time | 9 ms |
Memory | 8064 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 3 / 3 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 1 ms | 256 KB |
01 | AC | 7 ms | 5632 KB |
02 | AC | 9 ms | 8064 KB |
90 | AC | 1 ms | 256 KB |
91 | AC | 1 ms | 256 KB |