| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 15380 | wlgns88 | 달리는 게임 (kriii3_E) | C++98 | 155 ms | 12800 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 && 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 |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
