結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー algon_320algon_320
提出日時 2016-10-15 01:03:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 203 ms / 4,000 ms
コード長 1,952 bytes
コンパイル時間 1,657 ms
コンパイル使用メモリ 177,824 KB
実行使用メモリ 13,672 KB
最終ジャッジ日時 2023-08-14 12:43:04
合計ジャッジ時間 8,439 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 193 ms
13,016 KB
testcase_01 AC 182 ms
13,220 KB
testcase_02 AC 132 ms
11,708 KB
testcase_03 AC 155 ms
10,272 KB
testcase_04 AC 157 ms
10,192 KB
testcase_05 AC 155 ms
11,852 KB
testcase_06 AC 203 ms
13,672 KB
testcase_07 AC 154 ms
13,356 KB
testcase_08 AC 138 ms
12,048 KB
testcase_09 AC 130 ms
9,952 KB
testcase_10 AC 114 ms
8,964 KB
testcase_11 AC 128 ms
8,100 KB
testcase_12 AC 122 ms
8,864 KB
testcase_13 AC 93 ms
8,876 KB
testcase_14 AC 109 ms
8,776 KB
testcase_15 AC 83 ms
7,832 KB
testcase_16 AC 137 ms
9,072 KB
testcase_17 AC 137 ms
9,092 KB
testcase_18 AC 143 ms
8,812 KB
testcase_19 AC 93 ms
8,688 KB
testcase_20 AC 104 ms
8,860 KB
testcase_21 AC 103 ms
8,676 KB
testcase_22 AC 128 ms
8,584 KB
testcase_23 AC 110 ms
8,836 KB
testcase_24 AC 97 ms
8,732 KB
testcase_25 AC 126 ms
8,284 KB
testcase_26 AC 100 ms
7,816 KB
testcase_27 AC 117 ms
8,128 KB
testcase_28 AC 95 ms
9,408 KB
testcase_29 AC 128 ms
8,020 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 143 ms
9,492 KB
testcase_33 AC 146 ms
8,680 KB
testcase_34 AC 131 ms
10,368 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 3 ms
4,376 KB
testcase_40 AC 3 ms
4,380 KB
testcase_41 AC 11 ms
4,380 KB
testcase_42 AC 10 ms
4,376 KB
testcase_43 AC 10 ms
4,380 KB
testcase_44 AC 11 ms
4,380 KB
testcase_45 AC 4 ms
4,376 KB
testcase_46 AC 23 ms
4,376 KB
testcase_47 AC 22 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
// #define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=((int)(n)-1);v>=0;v--)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define SZ(c) ((int)c.size())
#define DUMP(x) cerr<<#x<<":="<<(x)<<endl
const int DX[9]={0,1,0,-1,1,1,-1,-1,0}, DY[9]={-1,0,1,0,-1,1,1,-1,0};
const int INF=1e9; const long long INFLL=1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<" "<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":"\n");return os;}
//------------------------------------------------------------------------------

struct team {
    int id;
    int s;
    int p;
    int u;
    int univ_rank;
};
bool comp(const team& l,const team& r) {
    return (l.s==r.s ? l.p<r.p : l.s>r.s);
}
bool comp2(const team& l,const team& r) {
    return (l.s==r.s ? (l.univ_rank==r.univ_rank ? l.p<r.p : l.univ_rank<r.univ_rank) : l.s>r.s);
}
signed main() {
    int n,k;
    cin>>n>>k;
    map<int,vector<team>> t;
    REP(i,n) {
        team te;
        te.id=i;
        te.univ_rank=INF;
        cin>>te.s>>te.p>>te.u;
        t[te.u].push_back(te);
    }

    vector<team> teams;
    ITR(i,t) {
        sort(ALL(i->second),comp);
        REP(j,SZ(i->second)) {
            (i->second)[j].univ_rank=j;
            // printf("id=%d s=%d p=%d u=%d rank=%d\n", (i->second)[j].id,(i->second)[j].s,(i->second)[j].p,(i->second)[j].u,(i->second)[j].univ_rank);
            teams.push_back((i->second)[j]);
        }
    }
    sort(ALL(teams),comp2);
    REP(i,k) {
        cout<<teams[i].id<<endl;
    }
    return 0;
}
0