結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
10,928 KB
testcase_01 AC 70 ms
11,096 KB
testcase_02 AC 53 ms
10,932 KB
testcase_03 AC 61 ms
10,972 KB
testcase_04 AC 62 ms
10,908 KB
testcase_05 AC 63 ms
10,952 KB
testcase_06 AC 80 ms
11,008 KB
testcase_07 AC 65 ms
10,960 KB
testcase_08 AC 58 ms
10,888 KB
testcase_09 AC 53 ms
10,804 KB
testcase_10 AC 53 ms
10,856 KB
testcase_11 AC 56 ms
10,368 KB
testcase_12 AC 57 ms
10,848 KB
testcase_13 AC 45 ms
10,824 KB
testcase_14 AC 49 ms
10,648 KB
testcase_15 AC 44 ms
10,272 KB
testcase_16 AC 57 ms
10,432 KB
testcase_17 AC 58 ms
10,824 KB
testcase_18 AC 57 ms
10,800 KB
testcase_19 AC 46 ms
10,732 KB
testcase_20 AC 51 ms
10,632 KB
testcase_21 AC 49 ms
10,720 KB
testcase_22 AC 56 ms
10,472 KB
testcase_23 AC 49 ms
10,816 KB
testcase_24 AC 46 ms
10,636 KB
testcase_25 AC 52 ms
10,436 KB
testcase_26 AC 46 ms
10,344 KB
testcase_27 AC 50 ms
10,296 KB
testcase_28 AC 45 ms
10,928 KB
testcase_29 AC 53 ms
10,536 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 4 ms
6,944 KB
testcase_32 AC 60 ms
11,136 KB
testcase_33 AC 59 ms
10,416 KB
testcase_34 AC 52 ms
10,860 KB
testcase_35 AC 3 ms
6,940 KB
testcase_36 AC 3 ms
6,940 KB
testcase_37 AC 3 ms
6,944 KB
testcase_38 AC 4 ms
6,940 KB
testcase_39 AC 4 ms
6,940 KB
testcase_40 AC 4 ms
6,944 KB
testcase_41 AC 9 ms
6,944 KB
testcase_42 AC 8 ms
6,940 KB
testcase_43 AC 8 ms
6,976 KB
testcase_44 AC 8 ms
6,944 KB
testcase_45 AC 4 ms
6,944 KB
testcase_46 AC 10 ms
6,944 KB
testcase_47 AC 10 ms
6,944 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--) {
		auto k=Q.top();
		Q.pop();
		_P("%d\n",k.second.second);
	}
}


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