Submission #1010711

#TimeUsernameProblemLanguageResultExecution timeMemory
1010711danikoynovMonochrome Points (JOI20_monochrome)C++14
0 / 100
0 ms344 KiB
#include<bits/stdc++.h> #define endl '\n' typedef long long ll; const int MAX_N = 1e6 + 10; int n; ll a[MAX_N], b[MAX_N]; void solve() { std::cin >> n; for (int i = 1; i <= n; i ++) std::cin >> a[i] >> b[i]; while(true) { bool done = true; for (int i = 1; i <= n; i ++) { int nxt = i + 1; if (i == n) nxt = 1; ll left = a[i] - b[i]; if (left < 0) left = 0; left /= 2; a[i] -= left * 2; a[nxt] += left; if (left != 0) done = false; } if (done) break; } bool fine = true; for (int i = 1; i <= n; i ++) if (a[i] != b[i]) fine = false; if (fine) std::cout << "Yes" << endl; else std::cout << "No" << endl; } void speed() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); } int main() { solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...