#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MAX_N = 1e6;
int n,a[MAX_N], b[MAX_N];
signed main(){
cin>>n;
for(int i = 0; i<n; i++){
cin>>a[i];
cin>>b[i];
}
for(int turn = 0; turn<35; turn++){
for(int i = 0; i<n; i++){
int dif= (a[i]-b[i])/2;
if(dif>0){
a[i]-=2*dif;
a[(i+1)%n] += dif;
}
}
}
bool ok = true;
for(int i = 0; i<n; i++){
ok &= a[i]==b[i];
}
if(ok){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |