結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー kurenai3110kurenai3110
提出日時 2016-10-14 23:14:36
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,273 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 83,664 KB
実行使用メモリ 17,588 KB
最終ジャッジ日時 2024-05-02 01:04:45
合計ジャッジ時間 12,180 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

	bool operator<(const ICPC& right) const {
		return s == right.s ? p < right.p : s > right.s;
	}
};
int Univ[100001];

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

	for (int i = 0; i < k; i++) {
		int solved = data[0].s;
		vector<pair<int,pair<int,int> > > Univ_pena;
		for (int j = 0; j<data.size() && data[j].s == solved;j++) {
			Univ_pena.push_back(make_pair(Univ[data[j].u],make_pair(data[j].p,data[j].num)));
		}
		sort(Univ_pena.begin(), Univ_pena.end());

		int university = Univ_pena[0].first;
		vector<pair<int,int> > pena;
		for (int l = 0; l<Univ_pena.size() && Univ_pena[l].first == university; l++) {
			pena.push_back(Univ_pena[l].second);
		}
		sort(pena.begin(), pena.end());

		cout << pena[0].second << endl;
		Univ[raw_data[pena[0].second].u]++;
		for (int j = 0; j < data.size(); j++) {
			if (data[j].num == pena[0].second) {
				data.erase(data.begin() + j);
				break;
			}
		}
	}

    return 0;
}
0