結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー sekiya9311sekiya9311
提出日時 2016-10-15 01:17:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 4,000 ms
コード長 2,212 bytes
コンパイル時間 1,839 ms
コンパイル使用メモリ 140,240 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2024-05-02 01:02:31
合計ジャッジ時間 7,262 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
9,856 KB
testcase_01 AC 110 ms
9,856 KB
testcase_02 AC 78 ms
9,600 KB
testcase_03 AC 101 ms
9,600 KB
testcase_04 AC 108 ms
9,728 KB
testcase_05 AC 91 ms
9,856 KB
testcase_06 AC 140 ms
9,856 KB
testcase_07 AC 89 ms
9,856 KB
testcase_08 AC 78 ms
9,728 KB
testcase_09 AC 88 ms
9,856 KB
testcase_10 AC 90 ms
9,344 KB
testcase_11 AC 102 ms
9,216 KB
testcase_12 AC 97 ms
9,600 KB
testcase_13 AC 63 ms
9,728 KB
testcase_14 AC 80 ms
9,472 KB
testcase_15 AC 56 ms
9,196 KB
testcase_16 AC 116 ms
9,344 KB
testcase_17 AC 112 ms
9,600 KB
testcase_18 AC 117 ms
9,728 KB
testcase_19 AC 65 ms
9,856 KB
testcase_20 AC 75 ms
9,600 KB
testcase_21 AC 69 ms
9,472 KB
testcase_22 AC 104 ms
9,344 KB
testcase_23 AC 81 ms
9,472 KB
testcase_24 AC 61 ms
9,344 KB
testcase_25 AC 91 ms
9,344 KB
testcase_26 AC 75 ms
9,344 KB
testcase_27 AC 90 ms
9,216 KB
testcase_28 AC 63 ms
9,600 KB
testcase_29 AC 100 ms
9,472 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 112 ms
9,856 KB
testcase_33 AC 115 ms
9,472 KB
testcase_34 AC 78 ms
9,600 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 3 ms
5,376 KB
testcase_39 AC 3 ms
5,376 KB
testcase_40 AC 3 ms
5,376 KB
testcase_41 AC 8 ms
5,376 KB
testcase_42 AC 8 ms
5,376 KB
testcase_43 AC 9 ms
5,376 KB
testcase_44 AC 8 ms
5,376 KB
testcase_45 AC 4 ms
5,376 KB
testcase_46 AC 20 ms
5,376 KB
testcase_47 AC 21 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <random>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cerr << C << endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a : b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int N, K;
vector<vector<tuple<int, int, int>>> uni;
vector<tuple<int, int, int, int, int>> PKUn;

int main(void) {
    cin >> N >> K;
    uni.resize(N);
    PKUn.resize(N);
    REP(i, N) {
        int s, p, u;
        scanf("%d%d%d", &s, &p, &u);
        uni[u].EB(make_tuple(s, -p, i));
        PKUn[i] = (make_tuple(s, -1, -p, u, i));
    }
    REP(i, N) if (uni[i].size()) {
        SORT(uni[i]);REVERSE(uni[i]);
        int cnt = 0;
        REP(j, uni[i].size()) {
            int s, r, p, u, id;
            tie(s,p,id) = uni[i][j];
            tie(s,r,p,u,id) = PKUn[id];
            r = cnt++;
            PKUn[id] = make_tuple(s,-r,p,u,id);
        }
    }
    SORT(PKUn); REVERSE(PKUn);
    REP(i, K) {
        cout << get<4>(PKUn[i]) << endl;
    }
}
0