fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long ll;
  5.  
  6. int main(int argc, char **argv) {
  7. int T;
  8. scanf("%d", &T);
  9. while (T-- != 0) {
  10. int a, b, c, d;
  11. scanf("%d%d%d%d", &a, &b, &c, &d);
  12. int s1 = a + c;
  13. int s2 = b + d;
  14. if (s1 > s2 || (s1 == s2 && c > b))
  15. puts("1");
  16. else if (s2 > s1 || (s2 == s1 && b > c))
  17. puts("2");
  18. else
  19. puts("-1");
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 4500KB
stdin
3
1 2 4 1
4 0 1 6
2 0 0 2
stdout
1
2
-1