fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4. const int K_MAX = 1000;
  5.  
  6. int main()
  7. {
  8. int c, k;
  9. int m, n;
  10. cin >> k >> c;
  11. for (int i=0;i<c;i++){
  12. cin >> m >> n;
  13. if (m <= n && (m + (k-m)/2 + 1) < n)
  14. cout << 0 << endl;
  15. else if (m > n && (n + (k-n)/2 +1) < m)
  16. cout << 0 << endl;
  17. else
  18. cout << 1 << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 15232KB
stdin
5
4
5 5
5 1
0 3
1 4
stdout
1
0
1
1