結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー chakkuchakku
提出日時 2016-10-15 18:37:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 158 ms / 4,000 ms
コード長 1,442 bytes
コンパイル時間 1,689 ms
コンパイル使用メモリ 188,212 KB
実行使用メモリ 10,160 KB
最終ジャッジ日時 2024-05-02 02:17:24
合計ジャッジ時間 7,373 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
10,080 KB
testcase_01 AC 132 ms
10,004 KB
testcase_02 AC 91 ms
9,836 KB
testcase_03 AC 124 ms
9,840 KB
testcase_04 AC 121 ms
9,828 KB
testcase_05 AC 108 ms
9,844 KB
testcase_06 AC 158 ms
10,036 KB
testcase_07 AC 97 ms
9,984 KB
testcase_08 AC 94 ms
9,840 KB
testcase_09 AC 101 ms
9,832 KB
testcase_10 AC 107 ms
9,560 KB
testcase_11 AC 122 ms
9,332 KB
testcase_12 AC 113 ms
9,704 KB
testcase_13 AC 85 ms
9,856 KB
testcase_14 AC 96 ms
9,552 KB
testcase_15 AC 70 ms
9,176 KB
testcase_16 AC 131 ms
9,408 KB
testcase_17 AC 139 ms
9,948 KB
testcase_18 AC 138 ms
9,836 KB
testcase_19 AC 84 ms
9,828 KB
testcase_20 AC 101 ms
9,864 KB
testcase_21 AC 96 ms
9,652 KB
testcase_22 AC 120 ms
9,532 KB
testcase_23 AC 106 ms
9,824 KB
testcase_24 AC 83 ms
9,540 KB
testcase_25 AC 119 ms
9,572 KB
testcase_26 AC 98 ms
9,368 KB
testcase_27 AC 120 ms
9,316 KB
testcase_28 AC 85 ms
9,840 KB
testcase_29 AC 126 ms
9,560 KB
testcase_30 AC 3 ms
5,504 KB
testcase_31 AC 4 ms
5,504 KB
testcase_32 AC 145 ms
10,160 KB
testcase_33 AC 148 ms
9,512 KB
testcase_34 AC 98 ms
9,844 KB
testcase_35 AC 4 ms
5,504 KB
testcase_36 AC 4 ms
5,504 KB
testcase_37 AC 3 ms
5,504 KB
testcase_38 AC 4 ms
5,760 KB
testcase_39 AC 4 ms
5,632 KB
testcase_40 AC 5 ms
5,632 KB
testcase_41 AC 13 ms
6,144 KB
testcase_42 AC 12 ms
6,144 KB
testcase_43 AC 12 ms
6,016 KB
testcase_44 AC 13 ms
6,016 KB
testcase_45 AC 6 ms
5,632 KB
testcase_46 AC 26 ms
6,144 KB
testcase_47 AC 26 ms
6,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
#define CININIT cin.tie(0),ios::sync_with_stdio(false)
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

constexpr ll mod = 1e9+7;

#define UNIV_MAX 100010

int main(){
    using P4 = tuple<int,int,int,int>;
    using P3 = tuple<int,int,int>;
    int n,k;
    cin>>n>>k;
    vector<vector<P3>> Univ(UNIV_MAX);
    rep(i,n){
        int s,p,u;cin>>s>>p>>u;
        Univ[u].push_back(P3(s,-p,i));
    }
    priority_queue<P4> que;


    rep(i,UNIV_MAX+1) if(Univ[i].size()){
        sort(all(Univ[i]));
        reverse(all(Univ[i]));
        for(int j=0;j<Univ[i].size();j++){
            int s,p,idx;
            tie(s,p,idx) = Univ[i][j];
            que.push(P4(s,-j,p,idx));
        }
    }

    rep(i,k){
        int s,u,p,x;
        tie(s,u,p,x) = que.top();
        que.pop();
        cout << x << endl;
    }
}
0