This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
int N,Q;
int max(int x,int y){return x>y?x:y;}
bool chk(int x,int y,bool delta){
x=max(0,x),y=max(0,y);
int round=max(x,y);
if((N-round)+x-delta<y)return 0;
if(x>(N-round)+y)return 0;
return 1;
}
int main(){
scanf("%d",&N);
scanf("%d",&Q);
int x,y;
for(int i=0;i<Q;i++){
scanf("%d%d",&x,&y);
if(chk(x-1,y,0)||chk(x,y-1,1)||chk(x,y,0))puts("1");
else puts("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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |