結果

問題 No.2680 研究室配属
ユーザー nikoro256nikoro256
提出日時 2024-03-20 22:17:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 541 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 208,252 KB
最終ジャッジ日時 2024-03-20 22:18:11
合計ジャッジ時間 17,970 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 52 ms
62,216 KB
testcase_04 AC 52 ms
64,272 KB
testcase_05 AC 87 ms
78,172 KB
testcase_06 AC 105 ms
79,604 KB
testcase_07 AC 106 ms
79,492 KB
testcase_08 AC 108 ms
78,988 KB
testcase_09 AC 77 ms
73,624 KB
testcase_10 AC 360 ms
98,944 KB
testcase_11 AC 342 ms
98,304 KB
testcase_12 AC 509 ms
105,332 KB
testcase_13 AC 367 ms
98,816 KB
testcase_14 AC 520 ms
107,648 KB
testcase_15 AC 128 ms
79,248 KB
testcase_16 AC 1,237 ms
136,588 KB
testcase_17 AC 257 ms
89,352 KB
testcase_18 AC 778 ms
112,908 KB
testcase_19 AC 1,655 ms
151,212 KB
testcase_20 AC 1,338 ms
143,436 KB
testcase_21 AC 163 ms
82,960 KB
testcase_22 AC 1,018 ms
123,744 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 AC 1,497 ms
205,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
import sys
input=sys.stdin.readline
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):
        hq.append([j,-T[i][j],i])
hq.sort()
use=[False for _ in range(N)]
ans=[[] for _ in range(M)]
for k in range(len(hq)):
    j,t,i=hq[k]
    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