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>
using namespace std;
typedef long long ll;
ll A[1000010];
ll B[1000010];
int main() {
ll N;
cin >> N;
for (ll i=0; i<N; i++) {
cin >> A[i] >> B[i];
}
for (ll loop=0; loop<100; loop++) {
for (ll i=0; i<N; i++) {
if (B[i] < A[i]) {
ll t = (A[i] - B[i]) / 2;
A[i] -= t * 2;
A[(i+1)%N] += t;
}
}
}
for (ll i=0; i<N; i++) {
if (A[i] != B[i]) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |