1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<string, string> pss; typedef vector<int> vi;
#define rep(i, a, n) for (int i = a; i < n; ++i) #define per(i, a, n) for (int i = n - 1; i >= a; --i) #define fi first #define se second #define mp make_pair #define np next_permutation #define pb push_back #define all(x) x.begin(), x.end() #define INF 0x3f3f3f3f
vector<pii> ans; int mmax = -INF;
bool cmp(pii a, pii b) { if (a.second != b.second) { return a.second > b.second; } else return a.fi < b.fi; }
int main() { ios::sync_with_stdio(false); rep(i, 1, 7 + 1) { int a, b; cin >> a >> b; if (a + b > 8) { ans.pb(mp(i, a + b)); } } if (ans.size() == 0) cout << 0 << endl; else { sort(all(ans), cmp); cout << ans[0].first << endl; } }
|