#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define endl '\n';
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define F fisrt
#define S second
#define for1(n) for(int i=1;i<=n;i++)
#define for0(n) for(int i=0;i<n;i++)
#define set_dec(x) cout<< fixed <<setprecision(x)<<endl;
const ll mod=1e9+7;
const ll inf=1e18+10;
const int N=1e6+10,L=21;
int A[N],B[N],C[N],D[N],n,m,q,k,dp[N],pre[N],vis[N];
vector<int>g[N];
int main(){
fast_io
cin>>n;
for1(n){
int a,b;cin>>a>>b;
A[i]=a-b;
}
for(int _=0;_<80;_++){
for1(n){
if(A[i]>0){
int t=A[i]/2*2;
A[i]-=t;
A[(i==n ? 1:i+1)]+=t/2;
}
}
}
for1(n)if(A[i]!=0)return cout<<"No\n",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... |