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>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ull, ull> pull;
typedef pair<ld, ld> pld;
ll a[1000009];
ll b[1000009];
ll n;
int main() {
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
cin >> n;
for(ll i = 0; i < n; ++i)
cin >> a[i] >> b[i];
ll cnt = 30;
while(cnt--){
for(ll i = 0; i < n; ++i){
ll dif = a[i]-b[i];
if(dif > 0){
a[i] -= dif/2*2;
a[(i+1)%n] += dif/2;
}
}
}
for(ll i = 0; i < n; ++i){
if(a[i] != b[i]){
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |