結果

問題 No.2680 研究室配属
ユーザー nikoro256nikoro256
提出日時 2024-03-20 22:22:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,440 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 245,280 KB
最終ジャッジ日時 2024-03-20 22:22:31
合計ジャッジ時間 10,560 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 42 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 48 ms
62,344 KB
testcase_04 AC 50 ms
62,344 KB
testcase_05 AC 64 ms
71,052 KB
testcase_06 AC 71 ms
73,764 KB
testcase_07 AC 71 ms
73,896 KB
testcase_08 AC 73 ms
73,668 KB
testcase_09 AC 62 ms
68,668 KB
testcase_10 AC 209 ms
100,352 KB
testcase_11 AC 204 ms
101,376 KB
testcase_12 AC 231 ms
94,964 KB
testcase_13 AC 212 ms
100,736 KB
testcase_14 AC 289 ms
109,440 KB
testcase_15 AC 79 ms
73,660 KB
testcase_16 AC 627 ms
145,772 KB
testcase_17 AC 139 ms
83,720 KB
testcase_18 AC 384 ms
115,808 KB
testcase_19 AC 830 ms
164,644 KB
testcase_20 AC 620 ms
143,428 KB
testcase_21 AC 112 ms
84,496 KB
testcase_22 AC 521 ms
135,908 KB
testcase_23 AC 1,432 ms
242,592 KB
testcase_24 AC 1,440 ms
245,280 KB
testcase_25 AC 933 ms
242,732 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(key=lambda a:a[0]*10000+a[1])
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