fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int n;
  9. while (cin >> n) {
  10. //cout << "n" << n << endl;
  11. if(!cin) break;
  12.  
  13. vector<vector<int>> bids(n, vector<int>(3)); // 競標價格
  14. for (int i = 0; i < n; ++i) {
  15. for (int j = 0; j < 3; ++j) {
  16. cin >> bids[i][j];
  17. }
  18. }
  19.  
  20. bool flow_mark = false;
  21. short get_plear = 0;
  22. long long n_base = bids[0][0] * 1000000LL + bids[0][1] * 1000LL + bids[0][2];
  23. //cout << "n_base " << n_base << endl;
  24. for (int i = 1; i < n; ++i) {
  25. long long n_ram = bids[i][0] * 1000000LL + bids[i][1] * 1000LL + bids[i][2];
  26. //cout << "n_ram " << n_ram << endl;
  27. if(n_base < n_ram){
  28. n_base = n_ram;
  29. flow_mark = false;
  30. get_plear = i;
  31. //cout << "change" <<endl;
  32. }else if(n_base == n_ram){
  33. flow_mark = true;
  34. //cout << "equal" <<endl;
  35. }
  36. //cout << "no change" <<endl;
  37. //cout << "n_base2 " << n_base << endl << endl;
  38. }
  39. get_plear++;
  40. cout << (flow_mark ? "F" : to_string(get_plear)) << endl;
  41. }
  42.  
  43. return 0;
  44. }
  45.  
Success #stdin #stdout 0s 5304KB
stdin
6
500 600 700
400 400 400
500 550 600
500 600 800
400 500 600
500 600 700
3
500 600 700
400 500 600
500 600 700
stdout
4
F