結果

問題 No.2680 研究室配属
ユーザー tkykwtnbtkykwtnb
提出日時 2024-03-23 17:59:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 580 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 42,240 KB
最終ジャッジ日時 2024-03-23 17:59:32
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,112 KB
testcase_01 AC 31 ms
10,112 KB
testcase_02 AC 27 ms
10,112 KB
testcase_03 AC 31 ms
10,112 KB
testcase_04 AC 31 ms
10,112 KB
testcase_05 AC 36 ms
10,240 KB
testcase_06 AC 40 ms
10,368 KB
testcase_07 AC 39 ms
10,368 KB
testcase_08 AC 37 ms
10,368 KB
testcase_09 AC 33 ms
10,240 KB
testcase_10 AC 72 ms
12,416 KB
testcase_11 AC 73 ms
11,776 KB
testcase_12 AC 91 ms
13,568 KB
testcase_13 AC 71 ms
11,264 KB
testcase_14 AC 91 ms
13,440 KB
testcase_15 AC 38 ms
10,496 KB
testcase_16 AC 181 ms
22,912 KB
testcase_17 AC 57 ms
10,880 KB
testcase_18 AC 120 ms
14,976 KB
testcase_19 AC 203 ms
27,520 KB
testcase_20 AC 183 ms
23,168 KB
testcase_21 AC 48 ms
10,624 KB
testcase_22 AC 170 ms
16,768 KB
testcase_23 AC 321 ms
42,240 KB
testcase_24 AC 316 ms
42,240 KB
testcase_25 AC 580 ms
42,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
T=[list(map(int,input().split())) for _ in range(N)]
ans=[-1 for _ in range(N)]
ok=0
L=[0 for _ in range(M)]
IDX=[0 for _ in range(N)]
while not ok:
    ok=1
    for p in range(N):
        if ans[p]!=-1:continue
        t=T[p][IDX[p]]
        if L[t]<A[t]:
            ans[p]=t
            L[t]+=1
        else:
            IDX[p]+=1
            ok=0
print(*ans)
0