結果

問題 No.2680 研究室配属
ユーザー nikoro256nikoro256
提出日時 2024-03-20 22:14:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 507 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 154,404 KB
最終ジャッジ日時 2024-03-20 22:14:23
合計ジャッジ時間 10,942 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 44 ms
53,460 KB
testcase_03 AC 82 ms
73,460 KB
testcase_04 AC 91 ms
76,372 KB
testcase_05 AC 150 ms
78,972 KB
testcase_06 AC 179 ms
80,360 KB
testcase_07 AC 173 ms
80,232 KB
testcase_08 AC 165 ms
79,724 KB
testcase_09 AC 125 ms
77,812 KB
testcase_10 AC 728 ms
96,608 KB
testcase_11 AC 717 ms
96,940 KB
testcase_12 AC 1,041 ms
103,224 KB
testcase_13 AC 747 ms
96,944 KB
testcase_14 AC 1,154 ms
104,752 KB
testcase_15 AC 182 ms
79,980 KB
testcase_16 TLE -
testcase_17 AC 507 ms
89,604 KB
testcase_18 AC 1,778 ms
117,664 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
N,M=map(int,input().split())
A=list(map(int,input().split()))
T=[]
for _ in range(N):
    T.append(list(map(int,input().split())))
hq=[]
for i in range(N):
    for j in range(M):
        heapq.heappush(hq,(j,-T[i][j],i))
use=[False for _ in range(N)]
ans=[[] for _ in range(M)]
while len(hq)>0:
    j,t,i=heapq.heappop(hq)
    t=-t
    if not use[i] and len(ans[t])<A[t]:
        ans[t].append(i)
        use[i]=True
fa=[-1]*N
for i in range(M):
    for a in ans[i]:
        fa[a]=i
print(*fa)
0