제출 #1121300

#제출 시각아이디문제언어결과실행 시간메모리
1121300Dan4Life송금 (JOI19_remittance)C++17
0 / 100
14 ms512 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) #define int long long const int N = (int)1e6+10; int n, a[N], b[N]; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; int ok = 1; for(int i = 0; i < n; i++) cin >> a[i] >> b[i]; int xd = n+10000000, i = 1; while(xd--){ int nx = (i+1==n?0:i+1); int tot = (a[i]-b[i]+1)/2; if(a[i]>b[i]) a[nx]+=tot,a[i]-=tot*2; i = nx; } for(int i = 0; i < n; i++) ok&=(a[i]==b[i]); cout << (ok?"Yes":"No") << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...