fork(1) download
  1. #include <cstdio>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. inline void getRestOfInput(int i, int n);
  6.  
  7. int main(){
  8.  
  9. int t;
  10. scanf("%d", &t);
  11.  
  12. while(t--) {
  13.  
  14. int n;
  15. scanf("%d", &n);
  16.  
  17. if( n < 3 ) {
  18.  
  19. printf("TAK\n");
  20.  
  21. getRestOfInput(0, n);
  22.  
  23. } else {
  24.  
  25. long long x1, y1, x2, y2;
  26. scanf("%lld %lld\n%lld %lld", &x1, &y1, &x2, &y2);
  27.  
  28. long long x3, y3;
  29. bool collinear = true;
  30.  
  31. for(int i = 2; i < n; ++i) {
  32.  
  33. scanf("%lld %lld", &x3, &y3);
  34.  
  35. if( x1 * y2 - x2 * y1 + x2 * y3 - x3 * y2 + x3 * y1 - y3 * x1 != 0 ) {
  36.  
  37. collinear = false;
  38.  
  39. getRestOfInput(i + 1, n);
  40. i = n;
  41.  
  42. }
  43.  
  44. }
  45.  
  46. if( collinear ) {
  47.  
  48. printf("TAK\n");
  49.  
  50. } else {
  51.  
  52. printf("NIE\n");
  53.  
  54. }
  55.  
  56. }
  57.  
  58. }
  59.  
  60. return 0;
  61. }
  62.  
  63. inline void getRestOfInput(int i, int n) {
  64.  
  65. int a;
  66.  
  67. for(; i < n; ++i) {
  68.  
  69. scanf("%d %d", &a, &a);
  70.  
  71. }
  72.  
  73. }
  74.  
Success #stdin #stdout 0s 3464KB
stdin
2
4
0 0 
2 2
11 11
-2 -2
3
1 0
0 0 
0 1
stdout
TAK
NIE