Submission #16610

# Submission time Handle Problem Language Result Execution time Memory
16610 2015-08-29T14:05:33 Z eaststar 달리는 게임 (kriii3_E) C++14
70 / 70
128 ms 8896 KB
#include <stdio.h>
int a[1000010],chk[1000010];
long long ans,s,cnt;
int main(){
    int i,n;
    scanf("%d",&n);
    for(i=1;i<=n;++i)scanf("%d",a+i);
    for(;i;){
        for(;i&&a[i]<=0;--i);
        for(s=0;i&&a[i]+s>0;s+=a[i--])chk[i]=1;
    }
    for(i=1;i<=n;++i){
        for(cnt=1;i<=n&&chk[i];)ans+=a[i++]*(cnt++);
    }
    printf("%lld",ans);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8896 KB Output is correct
2 Correct 0 ms 8896 KB Output is correct
3 Correct 0 ms 8896 KB Output is correct
4 Correct 0 ms 8896 KB Output is correct
5 Correct 0 ms 8896 KB Output is correct
6 Correct 0 ms 8896 KB Output is correct
7 Correct 0 ms 8896 KB Output is correct
8 Correct 0 ms 8896 KB Output is correct
9 Correct 0 ms 8896 KB Output is correct
10 Correct 0 ms 8896 KB Output is correct
11 Correct 0 ms 8896 KB Output is correct
12 Correct 0 ms 8896 KB Output is correct
13 Correct 0 ms 8896 KB Output is correct
14 Correct 0 ms 8896 KB Output is correct
15 Correct 0 ms 8896 KB Output is correct
16 Correct 1 ms 8896 KB Output is correct
17 Correct 0 ms 8896 KB Output is correct
18 Correct 0 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 8896 KB Output is correct
2 Correct 0 ms 8896 KB Output is correct
3 Correct 7 ms 8896 KB Output is correct
4 Correct 16 ms 8896 KB Output is correct
5 Correct 17 ms 8896 KB Output is correct
6 Correct 16 ms 8896 KB Output is correct
7 Correct 70 ms 8896 KB Output is correct
8 Correct 125 ms 8896 KB Output is correct
9 Correct 128 ms 8896 KB Output is correct