結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー sekiya9311sekiya9311
提出日時 2016-10-15 01:17:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 124 ms / 4,000 ms
コード長 2,212 bytes
コンパイル時間 1,579 ms
コンパイル使用メモリ 139,712 KB
実行使用メモリ 9,888 KB
最終ジャッジ日時 2023-08-14 12:46:38
合計ジャッジ時間 6,736 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
9,572 KB
testcase_01 AC 95 ms
9,888 KB
testcase_02 AC 67 ms
9,420 KB
testcase_03 AC 92 ms
9,516 KB
testcase_04 AC 88 ms
9,300 KB
testcase_05 AC 77 ms
9,364 KB
testcase_06 AC 124 ms
9,764 KB
testcase_07 AC 75 ms
9,836 KB
testcase_08 AC 65 ms
9,480 KB
testcase_09 AC 70 ms
9,364 KB
testcase_10 AC 80 ms
9,104 KB
testcase_11 AC 95 ms
8,988 KB
testcase_12 AC 90 ms
9,248 KB
testcase_13 AC 55 ms
9,528 KB
testcase_14 AC 72 ms
9,148 KB
testcase_15 AC 49 ms
8,968 KB
testcase_16 AC 106 ms
9,308 KB
testcase_17 AC 99 ms
9,424 KB
testcase_18 AC 106 ms
9,528 KB
testcase_19 AC 58 ms
9,492 KB
testcase_20 AC 69 ms
9,424 KB
testcase_21 AC 63 ms
9,236 KB
testcase_22 AC 90 ms
9,168 KB
testcase_23 AC 73 ms
9,516 KB
testcase_24 AC 56 ms
9,304 KB
testcase_25 AC 85 ms
9,240 KB
testcase_26 AC 66 ms
9,108 KB
testcase_27 AC 82 ms
8,928 KB
testcase_28 AC 55 ms
9,448 KB
testcase_29 AC 89 ms
9,184 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 102 ms
9,768 KB
testcase_33 AC 106 ms
9,252 KB
testcase_34 AC 68 ms
9,404 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,384 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 3 ms
4,380 KB
testcase_40 AC 2 ms
4,384 KB
testcase_41 AC 7 ms
4,376 KB
testcase_42 AC 7 ms
4,376 KB
testcase_43 AC 7 ms
4,376 KB
testcase_44 AC 8 ms
4,380 KB
testcase_45 AC 3 ms
4,380 KB
testcase_46 AC 18 ms
4,376 KB
testcase_47 AC 19 ms
4,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