結果

問題 No.2680 研究室配属
コンテスト
ユーザー Yakumo221
提出日時 2024-03-20 21:24:46
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 101 ms / 2,000 ms
+ 436µs
コード長 521 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 93 ms
コンパイル使用メモリ 64,896 KB
実行使用メモリ 70,724 KB
最終ジャッジ日時 2026-10-16 18:56:35
合計ジャッジ時間 4,827 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,m = map(int, input().split())
alist = list(map(int, input().split()))

tlist = [list(map(int, input().split())) for i in range(n)]

que = list(range(n)[::-1])

cntlist = [0 for i in range(m)]
ans = [0 for i in range(n)]

for i in range(m):
    nq = []

    while que:
        hito = que.pop()
        heya = tlist[hito][i]

        if cntlist[heya] < alist[heya]:
            cntlist[heya] += 1
            ans[hito] = heya
        else:
            nq.append(hito)
    
    que = sorted(nq, reverse=True)

print(*ans)
0