Submission #236862

#TimeUsernameProblemLanguageResultExecution timeMemory
236862egekabasRemittance (JOI19_remittance)C++14
0 / 100
5 ms384 KiB
#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 = 100; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...