제출 #94133

#제출 시각아이디문제언어결과실행 시간메모리
94133quoriessGo (COCI16_go)C++14
50 / 50
2 ms380 KiB
#include <bits/stdc++.h>
#include <unistd.h>
#include <set>
#define dbg(x) cout<<#x<<" has a value of: "<<x<<"\n";
typedef long long int lli;      
using namespace std;
typedef pair<lli,lli> pii;
int main(){
	int n;
	cin>>n;
	int ttl=0;
	vector<string> dizi(n);
	vector<pii> prs(n);
	for (int i = 0; i < n; i++)
	{
		cin>>dizi[i];
		int a,b;
		cin>>a>>b;
		prs[i]=pii(a,b);
	}
	
	int mx=-1;
	string cvb="";
	for(int i=n-1;i>=0;i--){

		int nb=prs[i].second;
		int lc=0;
		while(nb>=prs[i].first){
			nb-=prs[i].first;
			nb+=2;
			lc++;
			ttl++;
		}
		if(lc>=mx){
			mx=lc;
			cvb=dizi[i];
		}
	}
	cout<<ttl<<"\n"<<cvb<<"\n";
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...