結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー kurenai3110kurenai3110
提出日時 2016-10-15 09:01:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 107 ms / 4,000 ms
コード長 1,089 bytes
コンパイル時間 1,431 ms
コンパイル使用メモリ 79,392 KB
実行使用メモリ 7,940 KB
最終ジャッジ日時 2023-08-14 13:42:37
合計ジャッジ時間 5,655 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
7,640 KB
testcase_01 AC 77 ms
7,668 KB
testcase_02 AC 52 ms
7,048 KB
testcase_03 AC 81 ms
7,388 KB
testcase_04 AC 84 ms
7,200 KB
testcase_05 AC 65 ms
7,140 KB
testcase_06 AC 107 ms
7,940 KB
testcase_07 AC 56 ms
7,732 KB
testcase_08 AC 52 ms
7,776 KB
testcase_09 AC 69 ms
7,208 KB
testcase_10 AC 74 ms
7,276 KB
testcase_11 AC 88 ms
7,240 KB
testcase_12 AC 82 ms
6,900 KB
testcase_13 AC 50 ms
7,688 KB
testcase_14 AC 65 ms
7,164 KB
testcase_15 AC 41 ms
7,116 KB
testcase_16 AC 97 ms
7,432 KB
testcase_17 AC 98 ms
7,744 KB
testcase_18 AC 98 ms
7,696 KB
testcase_19 AC 50 ms
7,476 KB
testcase_20 AC 60 ms
6,972 KB
testcase_21 AC 57 ms
7,552 KB
testcase_22 AC 85 ms
7,164 KB
testcase_23 AC 67 ms
7,168 KB
testcase_24 AC 49 ms
7,488 KB
testcase_25 AC 79 ms
7,260 KB
testcase_26 AC 59 ms
7,508 KB
testcase_27 AC 80 ms
7,220 KB
testcase_28 AC 48 ms
7,240 KB
testcase_29 AC 85 ms
7,604 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,384 KB
testcase_32 AC 97 ms
6,896 KB
testcase_33 AC 101 ms
6,968 KB
testcase_34 AC 59 ms
7,692 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,384 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,384 KB
testcase_41 AC 6 ms
4,380 KB
testcase_42 AC 7 ms
4,380 KB
testcase_43 AC 6 ms
4,380 KB
testcase_44 AC 7 ms
4,380 KB
testcase_45 AC 4 ms
4,376 KB
testcase_46 AC 19 ms
4,380 KB
testcase_47 AC 19 ms
4,504 KB
権限があれば一括ダウンロードができます

ソースコード

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[100001];

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	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<long long, int> > pe_sort[11];
	for (int j = 0; j < data.size(); j++) {
		long long penalty = data[j].p + Univ[data[j].u] * (long long)1e7;
		pe_sort[data[j].s].push_back(make_pair(penalty, 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