# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
337322 | spatarel | 송금 (JOI19_remittance) | C++17 | 310 ms | 28652 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 ok1 = true;
bool ok2 = false;
for (int i = 0; i < n; i++) {
ok2 |= a[i] > 1;
}
for (int i = 0; i < n; i++) {
ok1 &= (a[i] == b[i]);
ok2 &= (a[i] - 1 == b[i]);
}
if (ok1 || ok2) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |