結果

問題 No.2680 研究室配属
ユーザー hato336hato336
提出日時 2024-03-20 21:36:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 562 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 98,488 KB
最終ジャッジ日時 2024-03-20 21:36:27
合計ジャッジ時間 6,600 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
85,048 KB
testcase_01 AC 136 ms
85,048 KB
testcase_02 AC 135 ms
85,048 KB
testcase_03 AC 151 ms
89,016 KB
testcase_04 AC 162 ms
88,888 KB
testcase_05 AC 158 ms
89,016 KB
testcase_06 AC 161 ms
89,144 KB
testcase_07 AC 158 ms
89,144 KB
testcase_08 AC 159 ms
89,016 KB
testcase_09 AC 157 ms
89,016 KB
testcase_10 AC 177 ms
89,784 KB
testcase_11 AC 185 ms
89,912 KB
testcase_12 AC 182 ms
89,912 KB
testcase_13 AC 176 ms
89,912 KB
testcase_14 AC 179 ms
89,912 KB
testcase_15 AC 159 ms
89,272 KB
testcase_16 AC 207 ms
92,088 KB
testcase_17 AC 172 ms
89,144 KB
testcase_18 AC 208 ms
91,064 KB
testcase_19 AC 220 ms
94,136 KB
testcase_20 AC 218 ms
93,368 KB
testcase_21 AC 167 ms
89,272 KB
testcase_22 AC 205 ms
92,088 KB
testcase_23 AC 290 ms
97,592 KB
testcase_24 AC 273 ms
97,592 KB
testcase_25 AC 562 ms
98,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
n,m = map(int,input().split())
a = list(map(int,input().split()))
hope = [list(map(int,input().split())) for i in range(n)]
ans = [-1 for i in range(n)]
room = [[] for i in range(m)]
kakutei = [0 for i in range(m)]
for j in range(m):
    for i in range(n):
        if ans[i] == -1:
            heapq.heappush(room[hope[i][j]],-i)
    for j in range(m):
        if len(room[j]) >= a[j]:
            while len(room[j]) > a[j]:
                heapq.heappop(room[j])
        for i in room[j]:
            ans[-i] = j
            a[j] -= 1
        room[j].clear()
    #print(room)
print(*ans)
0