結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー chocoruskchocorusk
提出日時 2020-09-27 00:37:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,144 ms / 4,000 ms
コード長 799 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 281,584 KB
最終ジャッジ日時 2023-09-12 13:17:44
合計ジャッジ時間 69,841 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,033 ms
274,484 KB
testcase_01 AC 1,999 ms
270,396 KB
testcase_02 AC 1,617 ms
271,656 KB
testcase_03 AC 1,390 ms
242,088 KB
testcase_04 AC 1,366 ms
243,480 KB
testcase_05 AC 1,702 ms
281,584 KB
testcase_06 AC 2,144 ms
268,040 KB
testcase_07 AC 1,955 ms
269,044 KB
testcase_08 AC 1,773 ms
271,708 KB
testcase_09 AC 1,336 ms
241,976 KB
testcase_10 AC 1,525 ms
224,544 KB
testcase_11 AC 1,547 ms
223,680 KB
testcase_12 AC 1,558 ms
227,188 KB
testcase_13 AC 1,568 ms
220,484 KB
testcase_14 AC 1,634 ms
232,884 KB
testcase_15 AC 1,830 ms
239,652 KB
testcase_16 AC 1,637 ms
224,916 KB
testcase_17 AC 1,514 ms
224,584 KB
testcase_18 AC 1,544 ms
220,560 KB
testcase_19 AC 1,553 ms
221,160 KB
testcase_20 AC 1,544 ms
228,140 KB
testcase_21 AC 1,496 ms
222,648 KB
testcase_22 AC 1,561 ms
225,684 KB
testcase_23 AC 1,520 ms
224,572 KB
testcase_24 AC 1,498 ms
224,500 KB
testcase_25 AC 1,529 ms
224,436 KB
testcase_26 AC 1,672 ms
228,224 KB
testcase_27 AC 1,642 ms
230,188 KB
testcase_28 AC 1,507 ms
224,096 KB
testcase_29 AC 1,659 ms
228,180 KB
testcase_30 AC 722 ms
196,584 KB
testcase_31 AC 726 ms
196,580 KB
testcase_32 AC 1,440 ms
226,316 KB
testcase_33 AC 1,405 ms
228,464 KB
testcase_34 AC 1,378 ms
239,976 KB
testcase_35 AC 712 ms
196,748 KB
testcase_36 AC 713 ms
196,484 KB
testcase_37 AC 725 ms
204,200 KB
testcase_38 AC 722 ms
202,764 KB
testcase_39 AC 746 ms
201,052 KB
testcase_40 AC 781 ms
201,840 KB
testcase_41 AC 830 ms
201,584 KB
testcase_42 AC 841 ms
202,872 KB
testcase_43 AC 866 ms
203,736 KB
testcase_44 AC 861 ms
202,736 KB
testcase_45 AC 752 ms
200,512 KB
testcase_46 AC 831 ms
202,188 KB
testcase_47 AC 829 ms
203,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

n, k=map(int, readline().split())
spu=list(map(int, read().split()))
s=spu[::3]
p=spu[1::3]
u=spu[2::3]
ans=[]
v0=[[] for _ in range(100001)]
for i in range(n):
    v0[u[i]].append(i)
v0.sort(key=lambda w: -len(w))
import copy
def solve(t):
    global ans
    v=copy.deepcopy(v0)
    for w in v:
        w.sort(key=lambda i: s[i]*(10**7)-p[i])
    while True:
        if not v[0]:
            break
        tops=[]
        for w in v:
            if not w:
                break
            i=w.pop()
            if s[i]==t:
                tops.append(i)
        tops.sort(key=lambda i: p[i])
        ans+=tops
for i in range(10, -1, -1):
    solve(i)
print('\n'.join(map(str, ans[:k])))
0