# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
337319 | 2020-12-19T17:15:29 Z | spatarel | 송금 (JOI19_remittance) | C++17 | 1 ms | 384 KB |
#include <stdio.h> int main() { int n; scanf("%d", &n); int a[n]; int b[n]; for (int i = 0; i < n; i++) { scanf("%d%d", &a[i], &b[i]); } int counter = 0; for (int i = 0; counter < n; i = (i + 1) % n) { int remittance = (a[i] - b[i]) / 2; if (remittance > 0) { a[i] -= 2 * remittance; a[(i + 1) % n] += remittance; counter = 0; } else { counter++; } } bool ok = true; for (int i = 0; i < n; i++) { ok &= (a[i] == b[i]); } if (ok) { printf("Yes\n"); } else { printf("No\n"); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Incorrect | 0 ms | 364 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Incorrect | 0 ms | 364 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Incorrect | 0 ms | 364 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |