結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー kurenai3110
提出日時 2016-10-15 08:25:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 995 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 77,256 KB
実行使用メモリ 6,480 KB
最終ジャッジ日時 2024-11-22 11:17:58
合計ジャッジ時間 6,883 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 42 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

struct ICPC {
	int s, p, u,num;

	bool operator<(const ICPC& right) const {
		if(u!=right.u) return u<right.u;
		if(s!=right.s) return s>right.s;
		return p<right.p;
	}
};

int Univ[100000];

int main()
{
	int n, k;
	cin >> n >> k;
	vector<ICPC> data;
	for (int i = 0; i < n; i++) {
		int s, p, u; cin >> s >> p >> u;
		ICPC icpc = { s,p,u,i };
		data.push_back(icpc);
	}
	sort(data.begin(), data.end());

	vector<pair<int,int> > pe_sort[11];
	for (int j = 0; j < data.size(); j++) {
		pe_sort[data[j].s].push_back(make_pair(data[j].p + Univ[data[j].u]*(int)1e6, data[j].num));
		Univ[data[j].u]++;
	}

	for (int i = 0; i < 11; i++) {
		sort(pe_sort[i].begin(), pe_sort[i].end());
	}

	int cnt = 0;
	for (int i = 10; i >= 0 ; i--) {
		for (int j = 0; j < pe_sort[i].size();j++) {
			cout << pe_sort[i][j].second << endl;
			cnt++;
			if (cnt == k) return 0;
		}
	}

    return 0;
}
0