# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15409 |
2015-07-12T07:15:34 Z |
yukariko |
달리는 게임 (kriii3_E) |
C++ |
|
6 ms |
9552 KB |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
long long a[1001];
long long dp[1001][1001];
int N;
long long solve(int pos, int cnt)
{
if(pos == N)
return 0;
long long &ret = dp[pos][cnt];
if(ret != -1)
return ret;
ret = max(ret, solve(pos+1, cnt));
ret = max(ret, a[pos] * (cnt+1) + solve(pos+1, cnt+1));
return ret;
}
int main()
{
memset(dp,-1,sizeof(dp));
cin >> N;
for(int i=0; i < N; i++)
cin >> a[i];
cout << solve(0, 0);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
9552 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |