답안 #94139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94139 2019-01-16T11:34:52 Z Kewo Go (COCI16_go) C++14
50 / 50
2 ms 380 KB
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

int n, maxi, tot;
string ans;

int f(int x, int y) {
	int ev = 0;
	while((y / x) != 0) {
		int tt = y;
		ev += tt / x;
		y -= (tt / x) * x;
		y += (tt / x) * 2;
	}
	return ev;
}

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> n;
	for(int i = 1; i <= n; i++) {
		int a, b;
		string s;
		cin >> s;
		cin >> a >> b;
		int t = f(a, b);
		tot += t;
		if(maxi < t) {
			maxi = t;
			ans = s;
		}
	}
	cout << tot << endl << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 1 ms 376 KB Output is correct
11 Correct 1 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 1 ms 376 KB Output is correct
14 Correct 1 ms 376 KB Output is correct
15 Correct 1 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 380 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 1 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 1 ms 252 KB Output is correct
25 Correct 1 ms 348 KB Output is correct