# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
254721 | dolphingarlic | Remittance (JOI19_remittance) | C++14 | 410 ms | 16248 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
long long a[1000000], b[1000000];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%lld %lld", a + i, b + i);
if (!accumulate(b, b + n, 0))
return puts(accumulate(a, a + n, 0) ? "No" : "Yes"), 0;
for (int i = 0; i < 50; i++) {
for (int i = 0; i < n; i++) {
if (a[i] > b[i]) {
a[(i + 1) % n] += (a[i] - b[i] + 1) / 2;
a[i] -= (a[i] - b[i] + 1) / 2 * 2;
}
}
}
bool p = 1;
for (int i = 0; i < n; i++) p &= (a[i] == b[i]);
puts(p ? "Yes" : "No");
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... |