結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー 🐬hec🐬hec
提出日時 2016-10-15 00:01:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 4,000 ms
コード長 1,766 bytes
コンパイル時間 2,684 ms
コンパイル使用メモリ 184,132 KB
実行使用メモリ 7,136 KB
最終ジャッジ日時 2023-08-14 11:27:22
合計ジャッジ時間 8,592 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
6,500 KB
testcase_01 AC 122 ms
6,548 KB
testcase_02 AC 96 ms
6,348 KB
testcase_03 AC 125 ms
6,244 KB
testcase_04 AC 125 ms
6,236 KB
testcase_05 AC 110 ms
6,388 KB
testcase_06 AC 154 ms
7,136 KB
testcase_07 AC 98 ms
6,488 KB
testcase_08 AC 97 ms
6,828 KB
testcase_09 AC 112 ms
6,656 KB
testcase_10 AC 116 ms
6,632 KB
testcase_11 AC 131 ms
6,632 KB
testcase_12 AC 122 ms
6,232 KB
testcase_13 AC 90 ms
6,756 KB
testcase_14 AC 103 ms
6,364 KB
testcase_15 AC 78 ms
6,912 KB
testcase_16 AC 141 ms
6,760 KB
testcase_17 AC 138 ms
6,580 KB
testcase_18 AC 144 ms
6,656 KB
testcase_19 AC 93 ms
6,580 KB
testcase_20 AC 100 ms
6,276 KB
testcase_21 AC 97 ms
6,628 KB
testcase_22 AC 126 ms
6,724 KB
testcase_23 AC 109 ms
6,688 KB
testcase_24 AC 90 ms
6,588 KB
testcase_25 AC 120 ms
6,636 KB
testcase_26 AC 98 ms
6,768 KB
testcase_27 AC 118 ms
6,668 KB
testcase_28 AC 89 ms
6,632 KB
testcase_29 AC 125 ms
6,584 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 137 ms
6,200 KB
testcase_33 AC 148 ms
6,756 KB
testcase_34 AC 105 ms
6,980 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 10 ms
4,376 KB
testcase_42 AC 10 ms
4,376 KB
testcase_43 AC 10 ms
4,380 KB
testcase_44 AC 10 ms
4,376 KB
testcase_45 AC 3 ms
4,376 KB
testcase_46 AC 23 ms
4,380 KB
testcase_47 AC 23 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

using i2=tuple<int,int>;
using i3=tuple<int,int,int>;
int n,k;

const int limit=100000;
int num[limit];
vector<i2> score[11];

int s[100010],p[100010],u[100010];

int main(void){
	cin >> n >> k;
	
	rep(i,n) cin >> s[i] >> p[i] >> u[i],u[i]--;
	rep(i,n) score[s[i]].push_back(i2(p[i],i));

	vector<int> ans;

	rrep(i,11){
		sort(_all(score[i]));
		vector<i3> cur; 
		for(auto &it:score[i]){
			int id;
			tie(ignore,id)=it;
			cur.push_back(i3(num[u[id]],p[id],id));
			num[u[id]]++;
		}
		sort(_all(cur));
		for(auto &it:cur) ans.push_back(get<2>(it));
	}
	
	rep(i,k) cout << ans[i] << endl;
	return 0;
}
0