이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
typedef long long ll;
int main() {
std::ios::sync_with_stdio(0); std::cin.tie(0);
int n; std::cin >> n;
std::vector <int> a(n, 0), b(a);
for (int i = 0; i < n; i++) std::cin >> a[i] >> b[i];
for (int tr = 0; tr < 100; tr++) {
for (int i = 0; i < n; i++) {
if (a[i] > b[i] && a[i] > 1) {
int now = a[i] - b[i] + 1;
now >>= 1;
if ((now << 1) > a[i]) now--;
a[i] -= now << 1;
a[(i + 1) % n] += now;
}
}
if (a == b) {
std::cout << "Yes\n";
return 0;
}
}
std::cout << "No\n";
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |