#include <cstdio>
#include <algorithm>
using namespace std;
int n,m;
int main(){
int i,a,s,l;
scanf("%d %d",&n,&m);
for(i=0;i<m;i++){
scanf("%d %d",&a,&s);
if(a>s) a--;
l=n-max(a,s);
if(s>a){
if(s-a<=l+1) printf("1\n");
else printf("0\n");
}else{
if(a-s<=l) printf("1\n");
else printf("0\n");
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
2 ms |
1084 KB |
Output is correct |
4 |
Correct |
23 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
16 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
22 ms |
1084 KB |
Output is correct |
7 |
Correct |
8 ms |
1084 KB |
Output is correct |
8 |
Correct |
24 ms |
1084 KB |
Output is correct |