結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 42 ms
53,460 KB
testcase_03 AC 47 ms
62,224 KB
testcase_04 AC 51 ms
62,216 KB
testcase_05 AC 76 ms
68,964 KB
testcase_06 AC 90 ms
71,680 KB
testcase_07 AC 90 ms
71,688 KB
testcase_08 AC 90 ms
71,476 KB
testcase_09 AC 70 ms
66,456 KB
testcase_10 AC 345 ms
100,992 KB
testcase_11 AC 314 ms
101,376 KB
testcase_12 AC 396 ms
95,348 KB
testcase_13 AC 326 ms
102,144 KB
testcase_14 AC 417 ms
95,232 KB
testcase_15 AC 104 ms
71,440 KB
testcase_16 AC 1,128 ms
149,136 KB
testcase_17 AC 211 ms
83,720 KB
testcase_18 AC 656 ms
108,316 KB
testcase_19 AC 1,450 ms
147,300 KB
testcase_20 AC 1,212 ms
141,100 KB
testcase_21 AC 152 ms
84,020 KB
testcase_22 AC 824 ms
117,180 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 AC 1,424 ms
222,320 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