# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
211615 | m3r8 | Remittance (JOI19_remittance) | C++14 | 5 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 1000100
#define ll long long
ll A[N];
ll B[N];
int cnt[N];
int main(void){
int n;
int nn = 1;
int nnn = 1;
scanf("%d",&n);
for(int i = 0;i<n;i++){
scanf("%lld %lld",&A[i],&B[i]);
if(B[i] != 0)nn = 0;
if(A[i] != 0)nnn = 0;
};
int pos = 1;
if(nn && !nnn)pos = 0;
if(pos){
for(int j = 0;j<2;j++){
for(int i = 0;i<n;i++){
if(A[i] > B[i]){
ll tmp = A[i]-B[i];
if(tmp % 2)tmp--;
tmp /= 2;
A[(i+1)%n] += tmp;
A[i] -= tmp * 2;
};
};
};
for(int i = 0;i<n;i++){
ll diff = A[i]-B[i];
pos = diff >= 0;
if(!pos)break;
for(int j = 0;j<32;j++){
if(diff & (1ull << j)){
cnt[(i+j)%n] ^= 1;
};
};
};
};
if(pos){
int st = cnt[0];
for(int i = 0;i<n;i++){
if(cnt[i] != st){
pos = 0;
break;
};
};
};
if(pos)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... |