fork download
  1. #include <vector>
  2. #include <list>
  3. #include <map>
  4. #include <set>
  5. #include <deque>
  6. #include <stack>
  7. #include <bitset>
  8. #include <algorithm>
  9. #include <functional>
  10. #include <numeric>
  11. #include <utility>
  12. #include <sstream>
  13. #include <iostream>
  14. #include <iomanip>
  15. #include <cstdio>
  16. #include <cmath>
  17. #include <cstdlib>
  18. #include <ctime>
  19. #define ll long long
  20.  
  21. using namespace std;
  22.  
  23. class PlaneGame {
  24. public:
  25. int bestShot(vector <int>, vector <int>);
  26. };
  27.  
  28. int PlaneGame::bestShot(vector <int> x, vector <int> y) {
  29. int n = x.size();
  30. int ans = 0;
  31. if(n == 1 || n == 2 || n == 3)
  32. {
  33. return n;
  34. return 0;
  35. }
  36. for(int i = 0;i < n;i++)
  37. {
  38. for(int j = 0;j < n;j++)
  39. {
  40. for(int k = 0;k < n;k++)
  41. {
  42. if(i == j || j == k || k == i)
  43. continue;
  44. int curans = 3;
  45. ll x1 = x[i], x2 = x[j], x3 = x[k];
  46. ll y1 = y[i], y2 = y[j], y3 = y[k];
  47. for(int l = 0;l < n;l++)
  48. {
  49. if(l == i || l == j || l == k) continue;
  50. ll x4 = x[l], y4 = y[l];
  51. bool b1 = (((x4-x3)*(x1-x2)+(y4-y3)*(y1-y2)) == 0);
  52. bool b2 = (((y4-y1)*(x1-x2)) == ((y1-y2)*(x4-x1)));
  53. if(b1 || b2) curans++;
  54. }
  55. ans = max(curans, ans);
  56. }
  57. }
  58. }
  59.  
  60. return ans;
  61. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i586-linux-gnu/5/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty