def main():
k = int(raw_input())
c = int(raw_input())
L = []
for i in range (c) :
s = map(int, raw_input().split())
L.append(s[::])
for i in range (c) :
m = L[i][0]
n = L[i][1]
if (m <= n and n > m + (k-m+1)/2) or (m > n and m > n + (k-n)/2 +1) :
print 0
else :
print 1
return 0
main()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2 KB |
Output is correct |
2 |
Correct |
18 ms |
2 KB |
Output is correct |
3 |
Correct |
16 ms |
2 KB |
Output is correct |
4 |
Correct |
17 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
2 KB |
Output is correct |
2 |
Correct |
15 ms |
2 KB |
Output is correct |
3 |
Correct |
20 ms |
2 KB |
Output is correct |
4 |
Correct |
17 ms |
3 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
3 KB |
Output is correct |
2 |
Correct |
20 ms |
3 KB |
Output is correct |
3 |
Correct |
49 ms |
4 KB |
Output is correct |
4 |
Correct |
365 ms |
16 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
16 KB |
Output is correct |
2 |
Correct |
26 ms |
16 KB |
Output is correct |
3 |
Correct |
209 ms |
16 KB |
Output is correct |
4 |
Correct |
265 ms |
16 KB |
Output is correct |
5 |
Correct |
379 ms |
21 KB |
Output is correct |
6 |
Correct |
380 ms |
22 KB |
Output is correct |
7 |
Correct |
391 ms |
22 KB |
Output is correct |
8 |
Correct |
398 ms |
24 KB |
Output is correct |