#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <string>
#include <map>
using namespace std;
int n, k, m, c, x, y;
string s, mx;
int main() {
cin >> n;
cin >> s;
mx = s;
cin >> k >> m;
while (k <= m){
m = m - k + 2;
c++;
}
x = c;
for (int i = 1; i < n; i++){
cin >> s;
cin >> k >> m;
y = 0;
while (k <= m){
m = m - k + 2;
c++;
y++;
}
if (y > x){
mx = s;
x = y;
}
}
cout << c << endl << mx;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
396 KB |
Output is correct |
3 |
Correct |
2 ms |
508 KB |
Output is correct |
4 |
Correct |
2 ms |
532 KB |
Output is correct |
5 |
Correct |
2 ms |
532 KB |
Output is correct |
6 |
Correct |
2 ms |
632 KB |
Output is correct |
7 |
Correct |
2 ms |
660 KB |
Output is correct |
8 |
Correct |
2 ms |
660 KB |
Output is correct |
9 |
Correct |
3 ms |
668 KB |
Output is correct |
10 |
Correct |
2 ms |
668 KB |
Output is correct |
11 |
Correct |
2 ms |
692 KB |
Output is correct |
12 |
Correct |
2 ms |
692 KB |
Output is correct |
13 |
Correct |
2 ms |
692 KB |
Output is correct |
14 |
Correct |
2 ms |
692 KB |
Output is correct |
15 |
Correct |
2 ms |
692 KB |
Output is correct |
16 |
Correct |
2 ms |
800 KB |
Output is correct |
17 |
Correct |
2 ms |
800 KB |
Output is correct |
18 |
Correct |
2 ms |
800 KB |
Output is correct |
19 |
Correct |
2 ms |
800 KB |
Output is correct |
20 |
Correct |
2 ms |
800 KB |
Output is correct |
21 |
Correct |
2 ms |
800 KB |
Output is correct |
22 |
Correct |
2 ms |
828 KB |
Output is correct |
23 |
Correct |
2 ms |
828 KB |
Output is correct |
24 |
Correct |
2 ms |
828 KB |
Output is correct |
25 |
Correct |
2 ms |
828 KB |
Output is correct |