# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15325 |
2015-07-12T06:02:03 Z |
sujin |
달리는 게임 (kriii3_E) |
C++ |
|
6 ms |
16736 KB |
#include <cstdio>
#define N 1000001
#define M 1001
int n,a[M];
long long s[N],q,mx[M],t[M][M];
int main ()
{
int i,j;
long long as;
scanf ("%d",&n);
for (i=1;i<=n;i++)
scanf ("%d",a+i),s[i]=s[i-1]+a[i];
for (i=1;i<=n;i++)
for (j=i;j<=n;j++)
t[i][j]=t[i][j-1]+a[j]*(j-i+1);
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
if (mx[i]<t[j][i])
mx[i]=t[j][i];
for (i=1;i<=n;i++)
{
if (mx[i]<mx[i-1])
mx[i]=mx[i-1];
for (j=1;j<=i;j++)
if (mx[i] < mx[j-1]+t[j][i])
mx[i] = mx[j-1]+t[j][i];
}
printf ("%lld\n",mx[n]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
16736 KB |
Output is correct |
2 |
Correct |
3 ms |
16736 KB |
Output is correct |
3 |
Correct |
6 ms |
16736 KB |
Output is correct |
4 |
Correct |
6 ms |
16736 KB |
Output is correct |
5 |
Correct |
3 ms |
16736 KB |
Output is correct |
6 |
Correct |
3 ms |
16736 KB |
Output is correct |
7 |
Correct |
3 ms |
16736 KB |
Output is correct |
8 |
Correct |
6 ms |
16736 KB |
Output is correct |
9 |
Correct |
6 ms |
16736 KB |
Output is correct |
10 |
Correct |
3 ms |
16736 KB |
Output is correct |
11 |
Correct |
6 ms |
16736 KB |
Output is correct |
12 |
Correct |
3 ms |
16736 KB |
Output is correct |
13 |
Correct |
3 ms |
16736 KB |
Output is correct |
14 |
Correct |
3 ms |
16736 KB |
Output is correct |
15 |
Correct |
3 ms |
16736 KB |
Output is correct |
16 |
Correct |
0 ms |
16736 KB |
Output is correct |
17 |
Correct |
3 ms |
16736 KB |
Output is correct |
18 |
Correct |
6 ms |
16736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
16732 KB |
futex (syscall #202) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |