結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー tossytossy
提出日時 2016-10-14 23:03:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,316 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 102,056 KB
実行使用メモリ 19,664 KB
最終ジャッジ日時 2024-05-02 00:45:49
合計ジャッジ時間 13,020 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
19,664 KB
testcase_01 AC 35 ms
9,564 KB
testcase_02 AC 32 ms
9,476 KB
testcase_03 AC 39 ms
9,472 KB
testcase_04 AC 40 ms
9,432 KB
testcase_05 AC 37 ms
9,556 KB
testcase_06 AC 45 ms
10,676 KB
testcase_07 AC 33 ms
9,472 KB
testcase_08 AC 33 ms
10,676 KB
testcase_09 AC 44 ms
10,800 KB
testcase_10 AC 1,459 ms
10,804 KB
testcase_11 AC 2,526 ms
10,808 KB
testcase_12 AC 221 ms
9,440 KB
testcase_13 AC 712 ms
10,800 KB
testcase_14 AC 414 ms
9,412 KB
testcase_15 AC 189 ms
10,804 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  int n,k;
  cin>>n>>k;
  vector<vector<int> > solves(11, vector<int>());
  vector<int> s(n), p(n), u(n);

  rep(i,n){
    scanf("%d %d %d", &s[i], &p[i], &u[i]);
    u[i]--;
    solves[s[i]].pb(i);
  }

  vector<int> solved(1000000, 0);

  int cnt=0;

  for(int sol=10; sol>=0; sol--){
    typedef pair<long, int> P;
    #define LLL 10000000
    priority_queue<P, vector<P>, greater<P> > pq;
    for(int i : solves[sol]){
      pq.push(mp((long)solved[u[i]]*LLL + p[i], i));
    }
    while(!pq.empty() && cnt<k){
      auto pp = pq.top(); pq.pop();
      int i = pp.se;
      if(pp.fi/LLL < solved[u[i]]){
        pq.push(mp((long)solved[u[i]]*LLL + p[i], i));
        continue;
      }
      printf("%d\n", i);
      solved[u[i]]++;
      cnt++;
    }

  }

  return 0;
}
0