fork(8) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int T;
  6. cin >> T;
  7. while(T--){
  8. int n;
  9. long long x0, y0, dx, dy, x, y, wyr;
  10. bool flaga{true};
  11. cin >> n;
  12. if(n <= 2)
  13. {}
  14. else{
  15. cin >> x0 >> y0;
  16. n--;
  17. while(n){
  18. n--;
  19. cin >> x >> y;
  20. if( x != x0 or y != y0){
  21. dx = x0 - x;
  22. dy = y0 - y;
  23. break;
  24. }
  25. }
  26. while(n--){
  27. cin >> x >> y;
  28. wyr = dx*(y0-y)- dy*(x0 - x);
  29. if(wyr){
  30. flaga = false;
  31. break;
  32. }
  33. }
  34. }
  35. if(flaga)
  36. cout << "TAK\n";
  37. else
  38. cout << "NIE\n";
  39. }
  40. }
  41.  
Success #stdin #stdout 0.01s 5404KB
stdin
7
4
0 0 
2 2
11 11
-2 -2
3
1 0
0 0 
0 1
1
1 1
3
0 0
0 0
0 0
4
0 0
0 0
0 0
2 3
3
1 2
1 3
1 4
8
0 0
7 1
14 2
21 3
28 4
35 5
42 6
49 7
stdout
TAK
NIE
TAK
TAK
TAK
TAK
TAK