Skip to content

Commit fb690d6

Browse files
committed
atcoder/abc033B
1 parent 0225ab1 commit fb690d6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

atcoder/abc033/B/main.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
int N;
8+
vector<string> S;
9+
vector<int> P;
10+
11+
string solve() {
12+
int sumP = 0;
13+
for (int i = 0; i < N; ++i) {
14+
sumP += P[i];
15+
}
16+
for (int i = 0; i < N; ++i) {
17+
if (P[i] * 2 > sumP) {
18+
return S[i];
19+
}
20+
}
21+
return "atcoder";
22+
}
23+
24+
int main() {
25+
ios_base::sync_with_stdio(false);
26+
cin.tie(0); cout.tie(0);
27+
28+
cin >> N;
29+
S.assign(N, "");
30+
P.assign(N, 0);
31+
for (int i = 0; i < N; ++i) {
32+
cin >> S[i] >> P[i];
33+
}
34+
35+
auto ans = solve();
36+
cout << ans << endl;
37+
38+
return 0;
39+
}

0 commit comments

Comments
 (0)