제출 #1242044

#제출 시각아이디문제언어결과실행 시간메모리
1242044thangdz2k7송금 (JOI19_remittance)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; void process(){ int n; cin >> n; vector <int> A(n), B(n); for (int i = 0; i < n; ++ i) cin >> A[i] >> B[i]; for (int loops = 0; loops < 32; ++ loops) { for (int i = 0; i < n; ++ i){ if (A[i] > B[i]){ int to = (A[i] - B[i]); if ((to & 1) && (to + 1) <= A[i]) to ++; A[i] -= to; A[(i + 1) % n] += to / 2; } } } for (int i = 0; i < n; ++ i) if (A[i] != B[i]){ cout << "No" << "\n"; return; } cout << "Yes" << "\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); process(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...