# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
555248 | nafis_shifat | Remittance (JOI19_remittance) | C++17 | 0 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e6+5;
const int inf=1e9;
int a[mxn], b[mxn];
int n;
void process() {
for(int i = 0; i < n; i++) {
int nxt = (i + 1) % n;
int rem = (a[i] - b[i]) / 2;
if(rem <= 0) continue;
a[nxt] += rem;
a[i] -= 2 * rem;
}
}
int main() {
cin >> n;
for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]);
for(int i = 0; i < 60; i++) process();
for(int i = 0; i < n; i++) if(a[i] != b[i]) {
cout<<"NO"<<endl;
return 0;
}
cout<<"YES"<<endl;
}
컴파일 시 표준 에러 (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... |