結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー maspymaspy
提出日時 2020-03-18 22:16:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 572 ms / 4,000 ms
コード長 679 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 54,436 KB
最終ジャッジ日時 2023-08-20 20:19:16
合計ジャッジ時間 22,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 536 ms
54,436 KB
testcase_01 AC 536 ms
54,420 KB
testcase_02 AC 535 ms
54,304 KB
testcase_03 AC 516 ms
54,308 KB
testcase_04 AC 531 ms
54,204 KB
testcase_05 AC 515 ms
54,268 KB
testcase_06 AC 547 ms
54,336 KB
testcase_07 AC 524 ms
54,136 KB
testcase_08 AC 522 ms
54,252 KB
testcase_09 AC 519 ms
54,348 KB
testcase_10 AC 541 ms
53,672 KB
testcase_11 AC 547 ms
53,928 KB
testcase_12 AC 542 ms
53,832 KB
testcase_13 AC 523 ms
53,808 KB
testcase_14 AC 525 ms
54,076 KB
testcase_15 AC 524 ms
54,192 KB
testcase_16 AC 544 ms
54,100 KB
testcase_17 AC 531 ms
53,740 KB
testcase_18 AC 553 ms
53,848 KB
testcase_19 AC 534 ms
53,808 KB
testcase_20 AC 526 ms
53,848 KB
testcase_21 AC 552 ms
53,532 KB
testcase_22 AC 572 ms
53,912 KB
testcase_23 AC 552 ms
53,572 KB
testcase_24 AC 546 ms
53,292 KB
testcase_25 AC 555 ms
53,848 KB
testcase_26 AC 540 ms
54,292 KB
testcase_27 AC 551 ms
54,144 KB
testcase_28 AC 549 ms
53,624 KB
testcase_29 AC 557 ms
54,160 KB
testcase_30 AC 27 ms
16,084 KB
testcase_31 AC 27 ms
16,104 KB
testcase_32 AC 544 ms
52,416 KB
testcase_33 AC 537 ms
52,428 KB
testcase_34 AC 537 ms
54,196 KB
testcase_35 AC 27 ms
15,948 KB
testcase_36 AC 26 ms
16,088 KB
testcase_37 AC 27 ms
16,036 KB
testcase_38 AC 27 ms
16,032 KB
testcase_39 AC 35 ms
16,388 KB
testcase_40 AC 35 ms
16,476 KB
testcase_41 AC 69 ms
19,876 KB
testcase_42 AC 67 ms
19,936 KB
testcase_43 AC 69 ms
20,004 KB
testcase_44 AC 68 ms
19,932 KB
testcase_45 AC 36 ms
16,372 KB
testcase_46 AC 70 ms
19,652 KB
testcase_47 AC 71 ms
19,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter

N, K = map(int, readline().split())
m = map(int, read().split())
S, P, U = zip(*zip(m, m, m))

SP = [-(s << 20) + p for s, p in zip(S, P)]
rank_1, _ = zip(*sorted(enumerate(SP), key=itemgetter(1)))
univ_cnt = [0] * (10 ** 6 + 10)
rank_in_univ = [0] * N
for i in rank_1:
    rank_in_univ[i] = univ_cnt[U[i]]
    univ_cnt[U[i]] += 1

key = (-(s << 40) + (r << 20) + p for s, r, p in zip(S, rank_in_univ, P))
answer, _ = zip(*sorted(enumerate(key), key=itemgetter(1)))
print('\n'.join(map(str, answer[:K])))
0