結果

提出番号 309
提出者 C3H5(ONO2)3
言語 C++
提出日時 2017-07-15 14:29:19
問題名 (23)世界最大のコンテスト2
結果 TLE
点数 0%

テストケース

テストケース 結果 得点 実行時間 メモリ使用量
1 WA 0% 1ms 8080KB
2 WA 0% 1ms 8320KB
3 WA 0% 43ms 7680KB
4 WA 0% 399ms 8096KB
5 TLE 0% 4141ms 12144KB

ソースコード

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main() {
	int n,ans=0,hoge=0,ho=-1;
	cin>>n;
	vector<int>v,c,d,e;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		v.push_back(a);
		c.push_back(a);
		d.push_back(b);
	}
	sort(v.begin(),v.end());
	e.push_back(v[0]);
	for(int i=1;i<n;i++){
		if(v[i]!=v[i-1]){
			e.push_back(v[i]);
		}
	}
	for(int i=0;i<e.size();i++){
		for(int j=0;j<n;j++){
			if(e[i]==c[j]){
				hoge+=d[j];
			}
		}
		if(ho<hoge){
			ans=e[i];
		}
		hoge=0;
	}
	cout<<ans<<endl;
	return 0;
}