#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
const int MN = 1000005;
int n;
pii a[MN];
int32_t main() {
boost();
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i].f >> a[i].s;
for (int t = 0; t < 30; t++) {
for (int i = 0; i < n; i++) {
if (a[i].f <= a[i].s) continue;
int d = (a[i].f - a[i].s) / 2;
a[i].f -= d * 2;
a[(i + 1) % n].f += d;
}
}
bool ok = 0;
//for (int i = 0; i < n; i++) ok &= a[i].f == a[i].s;
cout << (ok ? "YES\n" : "NO\n");
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |