| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1298283 | daotuankhoi | 송금 (JOI19_remittance) | C++20 | 1 ms | 576 KiB |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
template <class T> bool ckmax(T &a, T b) { return a < b ? (a = b, true) : false; }
template <class T> bool ckmin(T &a, T b) { return a > b ? (a = b, true) : false; }
const int MAXN = 1e6 + 5;
int a[MAXN], b[MAXN];
int main() {
#define NAME "test"
if (fopen(NAME".inp", "r")) {
freopen(NAME".inp", "r", stdin);
freopen(NAME".out", "w", stdout);
}
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
}
for (int i = 0; i < n; i++) {
int rem = a[i] - b[i];
if (rem <= 0) continue;
if (rem & 1) rem--;
a[i] -= rem;
a[(i + 1) % n] += rem / 2;
}
for (int i = 0; i < n; i++) {
int rem = a[i] - b[i];
if (rem <= 0) continue;
if (rem & 1) rem--;
a[i] -= rem;
a[(i + 1) % n] += rem / 2;
}
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) return cout << "No\n", 0;
}
cout << "Yes\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
