| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363827 | nanaseyuzuki | Remittance (JOI19_remittance) | C++20 | 1 ms | 344 KiB |
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
using namespace std;
#ifdef LOCAL
#include "C:\Users\Dell\Downloads\template\template\icpc-notebook\Utilities\debug.h"
#else
#define debug(...) 42
#endif
const int mn = 5e5 + 5, mod = 1e9 + 7, inf = 2e9;
int n, a[mn], b[mn];
void solve() {
cin >> n;
for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
for(int j = 1; j <= 60; j++) {
for(int i = 0; i < n; i++) {
if(a[i] > b[i]) {
int val = min(a[i] / 2, a[i] - b[i] + 1);
a[i] -= val * 2;
a[(i + 1) % n] += val;
}
}
}
for(int i = 0; i < n; i++) {
if(a[i] != b[i]) {
cout << "No\n";
return;
}
}
cout << "Yes\n";
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
#define task "Kawabata"
if (fopen(task".INP", "r")) {
freopen(task".INP", "r", stdin);
freopen(task".OUT", "w", stdout);
}
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}
// Don't wanna lose anymore T_T
// Never let me go - Kazuo IshiguroCompilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
