結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 453 ms
46,212 KB
testcase_01 AC 438 ms
46,336 KB
testcase_02 AC 340 ms
44,544 KB
testcase_03 AC 502 ms
45,036 KB
testcase_04 AC 493 ms
44,544 KB
testcase_05 AC 404 ms
45,184 KB
testcase_06 AC 597 ms
48,664 KB
testcase_07 AC 341 ms
44,544 KB
testcase_08 AC 428 ms
48,576 KB
testcase_09 AC 467 ms
47,488 KB
testcase_10 AC 420 ms
44,160 KB
testcase_11 AC 453 ms
44,160 KB
testcase_12 AC 381 ms
41,216 KB
testcase_13 AC 406 ms
44,288 KB
testcase_14 AC 347 ms
41,216 KB
testcase_15 AC 407 ms
44,160 KB
testcase_16 AC 472 ms
44,160 KB
testcase_17 AC 488 ms
44,288 KB
testcase_18 AC 473 ms
44,288 KB
testcase_19 AC 447 ms
44,160 KB
testcase_20 AC 358 ms
41,216 KB
testcase_21 AC 495 ms
44,160 KB
testcase_22 AC 559 ms
44,288 KB
testcase_23 AC 522 ms
44,288 KB
testcase_24 AC 453 ms
44,160 KB
testcase_25 AC 487 ms
44,288 KB
testcase_26 AC 465 ms
44,160 KB
testcase_27 AC 471 ms
44,160 KB
testcase_28 AC 410 ms
44,160 KB
testcase_29 AC 487 ms
44,288 KB
testcase_30 AC 30 ms
10,880 KB
testcase_31 AC 31 ms
10,880 KB
testcase_32 AC 537 ms
41,984 KB
testcase_33 AC 588 ms
45,440 KB
testcase_34 AC 544 ms
48,156 KB
testcase_35 AC 33 ms
10,880 KB
testcase_36 AC 32 ms
10,752 KB
testcase_37 AC 32 ms
10,880 KB
testcase_38 AC 31 ms
10,880 KB
testcase_39 AC 36 ms
11,136 KB
testcase_40 AC 36 ms
11,008 KB
testcase_41 AC 60 ms
13,824 KB
testcase_42 AC 66 ms
14,208 KB
testcase_43 AC 65 ms
14,208 KB
testcase_44 AC 60 ms
13,824 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,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[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