fork(2) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <cstdlib>
  7. #include <vector>
  8. #include <set>
  9. #include <map>
  10. #include <queue>
  11. #include <stack>
  12. #include <list>
  13. #include <cmath>
  14. #include <iomanip>
  15. #define dibs reserve
  16. #define OVER9000 1234567890
  17. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  18. #define tisic 47
  19. #define soclose 1e-8
  20. #define chocolate win
  21. // so much chocolate
  22. #define patkan 9
  23. #define ff first
  24. #define ss second
  25. #define abs(x) ((x < 0)?-(x):x)
  26. #define uint unsigned int
  27. #define dbl long double
  28. using namespace std;
  29. // mylittledoge
  30.  
  31. struct pt {
  32. unsigned long long x,y,z;
  33. };
  34.  
  35. pt vs(pt A, pt B) {
  36. pt ret;
  37. ret.x =A.y*B.z-A.z*B.y;
  38. ret.y =A.z*B.x-A.x*B.z;
  39. ret.z =A.x*B.y-A.y*B.x;
  40. return ret;}
  41.  
  42. int main() {
  43. cin.sync_with_stdio(0);
  44. cin.tie(0);
  45. int N;
  46. cin >> N;
  47. vector<pt> P(N);
  48. if(N < 3) {cout << "TAK\n"; return 0;}
  49. for(int i =0; i < N; i++) cin >> P[i].x >> P[i].y >> P[i].z;
  50.  
  51. for(int i =1; i < N; i++)
  52. P[i].x -=P[0].x, P[i].y -=P[0].y, P[i].z -=P[0].z;
  53.  
  54. int nepr =-1;
  55. pt V;
  56. for(int i =2; i < N; i++) {
  57. V =vs(P[i],P[1]);
  58. if(V.x == 0 && V.y == 0 && V.z == 0) continue;
  59. nepr =i;
  60. break;}
  61.  
  62. if(nepr == -1) {cout << "TAK\n"; return 0;}
  63.  
  64. for(int i =2; i < N; i++)
  65. if(P[i].x*V.x+P[i].y*V.y+P[i].z*V.z != 0) {
  66. cout << "NIE\n";
  67. return 0;}
  68.  
  69. cout << "TAK\n";
  70. return 0;}
  71.  
  72. // look at my code
  73. // my code is amazing
Runtime error #stdin #stdout #stderr 0s 3436KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc