結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
11,052 KB
testcase_01 AC 52 ms
11,096 KB
testcase_02 AC 44 ms
10,932 KB
testcase_03 AC 48 ms
10,968 KB
testcase_04 AC 48 ms
10,788 KB
testcase_05 AC 49 ms
10,948 KB
testcase_06 AC 57 ms
11,012 KB
testcase_07 AC 44 ms
11,080 KB
testcase_08 AC 44 ms
10,944 KB
testcase_09 AC 42 ms
10,804 KB
testcase_10 AC 42 ms
10,860 KB
testcase_11 AC 45 ms
10,364 KB
testcase_12 AC 48 ms
10,716 KB
testcase_13 AC 40 ms
10,828 KB
testcase_14 AC 44 ms
10,652 KB
testcase_15 AC 37 ms
10,276 KB
testcase_16 AC 46 ms
10,308 KB
testcase_17 AC 48 ms
10,948 KB
testcase_18 AC 51 ms
10,808 KB
testcase_19 AC 38 ms
10,864 KB
testcase_20 AC 41 ms
10,760 KB
testcase_21 AC 38 ms
10,720 KB
testcase_22 AC 47 ms
10,592 KB
testcase_23 AC 42 ms
10,820 KB
testcase_24 AC 36 ms
10,644 KB
testcase_25 AC 46 ms
10,568 KB
testcase_26 AC 42 ms
10,336 KB
testcase_27 AC 44 ms
10,420 KB
testcase_28 AC 39 ms
10,932 KB
testcase_29 AC 46 ms
10,632 KB
testcase_30 AC 3 ms
6,944 KB
testcase_31 AC 3 ms
6,940 KB
testcase_32 AC 52 ms
11,264 KB
testcase_33 AC 52 ms
10,656 KB
testcase_34 AC 44 ms
10,972 KB
testcase_35 AC 3 ms
6,940 KB
testcase_36 AC 4 ms
6,940 KB
testcase_37 AC 3 ms
6,944 KB
testcase_38 AC 3 ms
6,940 KB
testcase_39 AC 3 ms
6,940 KB
testcase_40 AC 3 ms
6,940 KB
testcase_41 AC 6 ms
6,940 KB
testcase_42 AC 6 ms
6,944 KB
testcase_43 AC 5 ms
6,940 KB
testcase_44 AC 6 ms
6,944 KB
testcase_45 AC 3 ms
6,940 KB
testcase_46 AC 10 ms
7,276 KB
testcase_47 AC 9 ms
6,940 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()) Q.push({{S[E[i][j].second],-j},{-P[E[i][j].second],E[i][j].second}});
	}
	
	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