제출 #83045

#제출 시각아이디문제언어결과실행 시간메모리
83045jvalsortavGo (COCI16_go)C++14
50 / 50
3 ms828 KiB
#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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...