| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 564209 | 4fecta | 송금 (JOI19_remittance) | C++17 | 206 ms | 576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
const int MN = 1000005;
int n;
pii a[MN * 2];
int fpow(int b, int p, int mod) {
if (!p) return 1;
int ret = fpow(b, p / 2, mod);
if (p & 1) return ret * ret % mod * b % mod;
return ret * ret % mod;
}
int32_t main() {
boost();
cin >> n;
int suma = 0, sumb = 0;
for (int i = 0; i < n; i++) {
cin >> a[i].f >> a[i].s;
suma += a[i].f * (1ll << i);
sumb += a[i].s * (1ll << i);
}
int was = (1ll << n) - 1;
int d = suma - sumb;
//if (d % was != 0) return 0 * printf("No\n");
for (int t = 0; t < 32; t++) { //wtf???
for (int i = 0; i < n; i++) {
if (a[i].s < a[i].f) {
int d = (a[i].f - a[i].s + 1) / 2;
a[i].f -= d * 2;
a[(i + 1) % n].f += d;
}
}
}
int sum = 0;
for (int i = 0; i < MN * 2; i++) {
assert(a[i].f >= 0 && a[i].s >= 0);
if (a[i].f != a[i].s) return 0 * printf("No\n");
sum += fpow(2, i, was) * (a[i].f - a[i].s) % was;
}
if (sum % was == 0) printf("Yes\n");
else printf("No\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... | ||||
