結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー mkawa2mkawa2
提出日時 2020-04-23 07:52:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,378 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 53,124 KB
最終ジャッジ日時 2024-04-21 05:46:24
合計ジャッジ時間 18,851 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 562 ms
47,336 KB
testcase_01 AC 438 ms
47,272 KB
testcase_02 AC 306 ms
45,696 KB
testcase_03 AC 453 ms
46,044 KB
testcase_04 AC 471 ms
45,492 KB
testcase_05 AC 376 ms
46,236 KB
testcase_06 AC 621 ms
53,124 KB
testcase_07 AC 301 ms
45,696 KB
testcase_08 AC 518 ms
52,340 KB
testcase_09 AC 501 ms
49,024 KB
testcase_10 AC 492 ms
44,572 KB
testcase_11 AC 525 ms
44,568 KB
testcase_12 AC 431 ms
41,344 KB
testcase_13 AC 443 ms
44,524 KB
testcase_14 AC 338 ms
41,472 KB
testcase_15 AC 445 ms
44,328 KB
testcase_16 AC 531 ms
44,568 KB
testcase_17 AC 528 ms
44,800 KB
testcase_18 AC 530 ms
44,444 KB
testcase_19 AC 450 ms
44,440 KB
testcase_20 AC 341 ms
41,344 KB
testcase_21 AC 453 ms
44,452 KB
testcase_22 AC 506 ms
44,800 KB
testcase_23 AC 478 ms
44,432 KB
testcase_24 AC 439 ms
44,800 KB
testcase_25 AC 503 ms
44,800 KB
testcase_26 AC 465 ms
44,800 KB
testcase_27 AC 506 ms
44,800 KB
testcase_28 AC 439 ms
44,452 KB
testcase_29 AC 517 ms
44,564 KB
testcase_30 AC 29 ms
10,880 KB
testcase_31 AC 30 ms
11,008 KB
testcase_32 AC 480 ms
42,368 KB
testcase_33 AC 543 ms
45,784 KB
testcase_34 AC 508 ms
49,952 KB
testcase_35 AC 29 ms
10,880 KB
testcase_36 AC 29 ms
10,752 KB
testcase_37 AC 29 ms
10,752 KB
testcase_38 AC 29 ms
10,880 KB
testcase_39 AC 31 ms
11,264 KB
testcase_40 AC 33 ms
11,008 KB
testcase_41 AC 53 ms
13,952 KB
testcase_42 AC 60 ms
14,208 KB
testcase_43 AC 61 ms
14,208 KB
testcase_44 AC 55 ms
13,952 KB
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
権限があれば一括ダウンロードができます

ソースコード

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,u,p,i))
    while 1:
        s,u,p,i=heappop(hp)
        score=s
        cur=defaultdict(list)
        heappush(cur[u],(p,i))
        while hp[0][0]==score:
            s, u, p, i = heappop(hp)
            heappush(cur[u], (p, i))
        cpi=[]
        for u,pi in cur.items():
            while pi:
                p,i=heappop(pi)
                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