結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー mkawa2mkawa2
提出日時 2020-04-23 08:01:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 526 ms / 4,000 ms
コード長 1,267 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 48,668 KB
最終ジャッジ日時 2024-04-21 05:59:29
合計ジャッジ時間 17,601 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 459 ms
46,184 KB
testcase_01 AC 397 ms
46,208 KB
testcase_02 AC 294 ms
44,544 KB
testcase_03 AC 405 ms
45,056 KB
testcase_04 AC 413 ms
44,544 KB
testcase_05 AC 339 ms
45,312 KB
testcase_06 AC 526 ms
48,668 KB
testcase_07 AC 297 ms
44,672 KB
testcase_08 AC 460 ms
48,456 KB
testcase_09 AC 468 ms
47,744 KB
testcase_10 AC 432 ms
44,160 KB
testcase_11 AC 463 ms
44,288 KB
testcase_12 AC 396 ms
41,216 KB
testcase_13 AC 408 ms
44,160 KB
testcase_14 AC 318 ms
41,344 KB
testcase_15 AC 381 ms
44,160 KB
testcase_16 AC 483 ms
44,160 KB
testcase_17 AC 468 ms
44,416 KB
testcase_18 AC 474 ms
44,288 KB
testcase_19 AC 390 ms
44,160 KB
testcase_20 AC 320 ms
41,344 KB
testcase_21 AC 419 ms
44,160 KB
testcase_22 AC 478 ms
44,416 KB
testcase_23 AC 422 ms
44,160 KB
testcase_24 AC 393 ms
44,288 KB
testcase_25 AC 449 ms
44,288 KB
testcase_26 AC 405 ms
44,288 KB
testcase_27 AC 452 ms
44,160 KB
testcase_28 AC 388 ms
44,160 KB
testcase_29 AC 466 ms
44,288 KB
testcase_30 AC 29 ms
10,880 KB
testcase_31 AC 30 ms
10,880 KB
testcase_32 AC 442 ms
42,112 KB
testcase_33 AC 504 ms
45,568 KB
testcase_34 AC 436 ms
48,292 KB
testcase_35 AC 31 ms
10,880 KB
testcase_36 AC 31 ms
10,880 KB
testcase_37 AC 31 ms
10,880 KB
testcase_38 AC 31 ms
10,752 KB
testcase_39 AC 34 ms
11,264 KB
testcase_40 AC 32 ms
11,136 KB
testcase_41 AC 55 ms
13,952 KB
testcase_42 AC 59 ms
14,208 KB
testcase_43 AC 59 ms
14,208 KB
testcase_44 AC 54 ms
14,080 KB
testcase_45 AC 34 ms
11,392 KB
testcase_46 AC 76 ms
14,080 KB
testcase_47 AC 76 ms
14,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    n,k=MI()
    spu=LLI(n)
    hp=[]
    uni=defaultdict(int)
    for i,(s,p,u) in enumerate(spu):
        heappush(hp,(-s,p,u,i))
    while 1:
        s,p,u,i=heappop(hp)
        score=s
        cpi=[]
        c = uni[u]
        uni[u] += 1
        heappush(cpi, (c, p, i))
        while hp and hp[0][0]==score:
            s, p, u, i = heappop(hp)
            c = uni[u]
            uni[u] += 1
            heappush(cpi, (c, p, i))
        while cpi:
            c,p,i=heappop(cpi)
            print(i)
            k-=1
            if k==0:exit()

main()
0