結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー dnish
提出日時 2018-06-23 15:17:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,081 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 186,696 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2024-06-30 18:24:14
合計ジャッジ時間 14,123 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll inf=1e18;

ll N, K;

int main(){

    while(cin>>N>>K){
        pair<pair<ll,ll>, ll> A[100010];

        ll S[100010], P[100010], U[100010];
        map<ll,ll> m;
        map<ll, vector<pair<ll,ll>>> last;
        REP(i,0,N){
            cin>>S[i]>>P[i]>>U[i];
            U[i]--;
            m[U[i]]++;
            last[P[i]].push_back({-S[i],i});
        }
        REP(i,0,N){
            A[i] = {{-S[i],m[U[i]]},P[i]};
        }
        sort(A,A+N);
        REP(i,0,K){
            REP(j,0,last[A[i].second].size()) {
                if(last[A[i].second][j].first == A[i].first.first){
                    p(last[A[i].second][j].second);
                    break;
                }
            }
        }

    }

    return 0;
}
0