Submission #15265

# Submission time Handle Problem Language Result Execution time Memory
15265 2015-07-12T05:01:54 Z ainta 달리는 게임 (kriii3_E) C++
70 / 70
177 ms 12920 KB
#include<stdio.h>
long long S[1010000], SS, Res;
int w[1010000];
int n;
int main(){
    int i, j;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&w[i]);
        S[i]=S[i-1]+w[i];
    }
    for(i=n;i>=1;i--){
        if(w[i] > 0){
            SS = 0;
            for(j=i-1;j>=0;j--){
                if(S[i]<S[j])break;
                SS += S[i]-S[j];
            }
            Res += SS;
            i=j+1;
        }
    }
    printf("%lld\n",Res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 12920 KB Output is correct
2 Correct 0 ms 12920 KB Output is correct
3 Correct 0 ms 12920 KB Output is correct
4 Correct 0 ms 12920 KB Output is correct
5 Correct 0 ms 12920 KB Output is correct
6 Correct 0 ms 12920 KB Output is correct
7 Correct 0 ms 12920 KB Output is correct
8 Correct 0 ms 12920 KB Output is correct
9 Correct 0 ms 12920 KB Output is correct
10 Correct 0 ms 12920 KB Output is correct
11 Correct 0 ms 12920 KB Output is correct
12 Correct 0 ms 12920 KB Output is correct
13 Correct 0 ms 12920 KB Output is correct
14 Correct 0 ms 12920 KB Output is correct
15 Correct 0 ms 12920 KB Output is correct
16 Correct 0 ms 12920 KB Output is correct
17 Correct 0 ms 12920 KB Output is correct
18 Correct 0 ms 12920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12920 KB Output is correct
2 Correct 0 ms 12920 KB Output is correct
3 Correct 7 ms 12920 KB Output is correct
4 Correct 11 ms 12920 KB Output is correct
5 Correct 15 ms 12920 KB Output is correct
6 Correct 12 ms 12920 KB Output is correct
7 Correct 69 ms 12920 KB Output is correct
8 Correct 177 ms 12920 KB Output is correct
9 Correct 134 ms 12920 KB Output is correct