답안 #15253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15253 2015-07-12T04:37:56 Z gs13068 달리는 게임 (kriii3_E) C++
26 / 70
2 ms 1116 KB
#include<cstdio>
#include<algorithm>

long long a[1111];
long long s[1111];
long long ss[1111];
long long d[1111];

int main()
{
    int i,j,n;
    scanf("%d",&n);
    for(i=1;i<=n;i++)scanf("%lld",&a[i]);
    for(i=n;i>=0;i--)
    {
        s[i]=s[i+1]+a[i];
        ss[i]=ss[i+1]+s[i+1];
        d[i]=ss[i];
        for(j=i+1;j<=n;j++)d[i]=std::max(d[i],d[j]+ss[i]-ss[j]-s[j]*(j-i));
    }
    printf("%lld\n",d[0]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 2 ms 1116 KB Output is correct
3 Correct 2 ms 1116 KB Output is correct
4 Correct 0 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 0 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
8 Correct 2 ms 1116 KB Output is correct
9 Correct 2 ms 1116 KB Output is correct
10 Correct 0 ms 1116 KB Output is correct
11 Correct 0 ms 1116 KB Output is correct
12 Correct 0 ms 1116 KB Output is correct
13 Correct 0 ms 1116 KB Output is correct
14 Correct 2 ms 1116 KB Output is correct
15 Correct 1 ms 1116 KB Output is correct
16 Correct 0 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 2 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1112 KB futex (syscall #202) was called by the program (disallowed syscall)
2 Halted 0 ms 0 KB -