結果

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

ソースコード

diff #

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

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

	bool operator<(const ICPC& right) const {
		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());

	for (int j = 0; j < data.size(); j++) {
		data[j].p += Univ[data[j].u] * (long long)1e7;
		Univ[data[j].u]++;
	}
	sort(data.begin(), data.end());

	for (int j = 0; j < k; j++) {
		cout << data[j].num << endl;
	}

	return 0;
}
0