fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. map < long long , int > cnt;
  5.  
  6. class PlaneGame
  7. {
  8. public: int bestShot(vector <int> x, vector <int> y)
  9. {
  10. int n = x.size();
  11. int ans = min(n, 1);
  12. for(int i = 0; i < n; i++)
  13. for(int j = i+1; j < n; j++)
  14. {
  15. long long dx = x[i] - x[j];
  16. long long dy = y[i] - y[j];
  17. long long dx2 = dy;
  18. long long dy2 = -dx;
  19. long long val = x[i] * dx2 + y[i] * dy2;
  20. int cntOnLine = 0;
  21. int maxPerpendicular = 0;
  22. cnt.clear();
  23. for(int k = 0; k < n; k++)
  24. if(x[k] * dx2 + y[k] * dy2 == val)
  25. cntOnLine ++;
  26. else
  27. {
  28. long long v = x[k] * dx + y[k] * dy;
  29. cnt[v] ++;
  30. maxPerpendicular = max(maxPerpendicular, cnt[v]);
  31. }
  32. ans = max(ans, maxPerpendicular + cntOnLine);
  33. }
  34. return ans;
  35. }
  36. };
  37.  
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