結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー 👑 kmjpkmjp
提出日時 2016-10-15 00:16:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 59 ms / 4,000 ms
コード長 1,181 bytes
コンパイル時間 1,399 ms
コンパイル使用メモリ 172,204 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-05-02 00:05:19
合計ジャッジ時間 4,604 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
11,056 KB
testcase_01 AC 52 ms
11,096 KB
testcase_02 AC 44 ms
10,932 KB
testcase_03 AC 49 ms
10,976 KB
testcase_04 AC 49 ms
10,912 KB
testcase_05 AC 47 ms
10,952 KB
testcase_06 AC 59 ms
11,260 KB
testcase_07 AC 47 ms
11,084 KB
testcase_08 AC 44 ms
10,944 KB
testcase_09 AC 44 ms
10,928 KB
testcase_10 AC 45 ms
10,852 KB
testcase_11 AC 47 ms
10,360 KB
testcase_12 AC 48 ms
10,848 KB
testcase_13 AC 39 ms
10,828 KB
testcase_14 AC 43 ms
10,648 KB
testcase_15 AC 40 ms
10,276 KB
testcase_16 AC 50 ms
10,308 KB
testcase_17 AC 50 ms
10,948 KB
testcase_18 AC 47 ms
10,936 KB
testcase_19 AC 39 ms
10,864 KB
testcase_20 AC 40 ms
10,760 KB
testcase_21 AC 38 ms
10,704 KB
testcase_22 AC 45 ms
10,592 KB
testcase_23 AC 40 ms
10,820 KB
testcase_24 AC 37 ms
10,640 KB
testcase_25 AC 44 ms
10,568 KB
testcase_26 AC 40 ms
10,468 KB
testcase_27 AC 43 ms
10,408 KB
testcase_28 AC 39 ms
10,888 KB
testcase_29 AC 47 ms
10,664 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 3 ms
6,940 KB
testcase_32 AC 49 ms
11,264 KB
testcase_33 AC 50 ms
10,652 KB
testcase_34 AC 46 ms
10,972 KB
testcase_35 AC 3 ms
6,944 KB
testcase_36 AC 3 ms
6,944 KB
testcase_37 AC 3 ms
6,944 KB
testcase_38 AC 3 ms
6,940 KB
testcase_39 AC 4 ms
6,940 KB
testcase_40 AC 3 ms
6,944 KB
testcase_41 AC 6 ms
6,940 KB
testcase_42 AC 5 ms
6,944 KB
testcase_43 AC 6 ms
6,940 KB
testcase_44 AC 6 ms
6,944 KB
testcase_45 AC 3 ms
6,944 KB
testcase_46 AC 8 ms
6,944 KB
testcase_47 AC 8 ms
7,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
int S[101010];
int P[101010];
int U[101010];
vector<pair<pair<int,int>,int>> E[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	FOR(i,N) {
		cin>>S[i]>>P[i]>>U[i];
		E[U[i]].push_back({{S[i],-P[i]},i});
	}
	
	priority_queue<pair<pair<int,int>,pair<int,int>>> Q;
	FOR(i,101000) if(E[i].size()) {
		sort(ALL(E[i]));
		reverse(ALL(E[i]));
		FOR(j,E[i].size()) {
			x = E[i][j].second;
			Q.push({{S[x],-j},{-P[x],x}});
		}
	}
	
	while(K--) {
		_P("%d\n",Q.top().second.second);
		Q.pop();
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0