# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15353 |
2015-07-12T06:33:36 Z |
wlgns88 |
달리는 게임 (kriii3_E) |
C++ |
|
0 ms |
12800 KB |
#include <stdio.h>
long long int item[1000000];
int check[1000000];
int main()
{
int n, i;
long long int result = 0;
scanf("%d", &n);
for ( i = 0; i < n; i++ )
scanf("%lld", &item[i]);
i = n-1;
while ( i >= 0 ) {
long long int sum = 0;
while ( i >= 0 && item[i] <= 0 )
i--;
while ( i >= 0 && item[i] >= 0 ) {
check[i] = 1;
sum += item[i--];
}
while ( i >= 0 && item[i] <= 0 && sum + item[i] > 0 ) {
check[i] = 1;
sum += item[i--];
}
}
for ( i = 0; i < n; i++ ) {
int cnt = 1;
while ( i < n && check[i] == 1 )
result += item[i++] * cnt++;
}
printf("%lld\n", result);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
12800 KB |
Output is correct |
2 |
Incorrect |
0 ms |
12800 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |