| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1354425 | fggg | Remittance (JOI19_remittance) | C++20 | 1 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll k = 1e6;
void solve() {
ll n;
cin >> n;
vector<ll> df(n);
for (ll i = 0; i < n; i++) {
ll x, y;
cin >> x >> y;
df[i] = x - y;
}
while (k--) {
ll mx = -1e18, mi = 1e18;
for (ll i = 0; i < n; i++) mx = max(mx, df[i]), mi = min(mi, df[i]);
if (mx < 0) {
cout << "No";
return;
}
if (mx == 0 && mi == 0) {
cout << "Yes";
return;
}
for (ll i = 0; i < n; i++) {
if (df[i] == mx) {
ll cr = 1;
df[i] -= 2 * cr;
df[(i + 1) % n] += cr;
break;
}
}
}
cout << "No";
}
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll t = 1;
//cin >> t;
while (t--) {
solve();
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
