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 1234567890123456789LL
  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. int main() {
  32. cin.sync_with_stdio(0);
  33. cin.tie(0);
  34. int T;
  35. cin >> T;
  36. for(int t =0; t < T; t++) {
  37. int N;
  38. cin >> N;
  39. int x =0;
  40. double y =-(1e8);
  41. for(int i =0; i < N; i++) {
  42. int a,b,c;
  43. cin >> a >> b >> c;
  44. double r =0.5*b/a;
  45. double z =-a*r*r+b*r+c;
  46. y =max(y,z);
  47. if(z >= y-0.1) x =i+1;}
  48. cout << x << "\n";}
  49. return 0;}
  50.  
  51. // look at my code
  52. // my code is amazing
Success #stdin #stdout 0s 3476KB
stdin
3
1
1 4 2
2
3 126 1400
2 152 208
2
3 127 1400
2 154 208
stdout
1
2
2