| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 147496 | dolphingarlic | Remittance (JOI19_remittance) | C++14 | 2 ms | 380 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 <bits/stdc++.h>
#pragma GCC Optimize("O3")
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define MOD 1000000007
typedef long long ll;
using namespace std;
int a[1000000], b[1000000];
int main() {
iostream::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
FOR(i, 0, n) cin >> a[i] >> b[i];
bool possible = true;
do {
possible = false;
FOR(i, 0, n) {
if (a[i] - b[i] > 1) {
a[(i + 1) % n] += (a[i] - b[i]) / 2;
a[i] -= (a[i] - b[i]) / 2 * 2;
}
}
FOR(i, 0, n) possible |= (a[i] - b[i] > 1);
} while (possible);
bool ans = true;
FOR(i, 0, n) ans &= (a[i] == b[i]);
if (ans) cout << "Yes";
else cout << "No";
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... | ||||
