| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 337319 | spatarel | Remittance (JOI19_remittance) | C++17 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (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... | ||||
