제출 #1253278

#제출 시각아이디문제언어결과실행 시간메모리
1253278ender_shayan송금 (JOI19_remittance)C++20
100 / 100
414 ms27852 KiB
#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; bool oo=0; for1(n){ int a,b;cin>>a>>b; A[i]=a-b; oo|=(b!=0); } 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; } } } bool o=1; for1(n)o&=(A[i]==1); if(o){ cout<<(oo ? "Yes\n":"No\n"); return 0; } for1(n)if(A[i]!=0)return cout<<"No\n",0; cout<<"Yes\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...