結果

問題 No.2680 研究室配属
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2024-02-29 17:18:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 85,108 KB
最終ジャッジ日時 2024-03-18 21:54:04
合計ジャッジ時間 3,457 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 43 ms
59,716 KB
testcase_04 AC 43 ms
61,832 KB
testcase_05 AC 47 ms
65,940 KB
testcase_06 AC 50 ms
67,988 KB
testcase_07 AC 52 ms
67,988 KB
testcase_08 AC 52 ms
67,996 KB
testcase_09 AC 50 ms
65,952 KB
testcase_10 AC 71 ms
76,672 KB
testcase_11 AC 74 ms
76,672 KB
testcase_12 AC 80 ms
77,044 KB
testcase_13 AC 76 ms
76,672 KB
testcase_14 AC 83 ms
77,312 KB
testcase_15 AC 60 ms
70,176 KB
testcase_16 AC 107 ms
79,348 KB
testcase_17 AC 73 ms
76,288 KB
testcase_18 AC 96 ms
77,824 KB
testcase_19 AC 129 ms
81,012 KB
testcase_20 AC 118 ms
79,860 KB
testcase_21 AC 74 ms
75,940 KB
testcase_22 AC 109 ms
78,836 KB
testcase_23 AC 173 ms
84,980 KB
testcase_24 AC 186 ms
85,108 KB
testcase_25 AC 182 ms
84,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

想定解

"""

N,M = map(int,input().split())

A = list(map(int,input().split()))

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

assert 1 <= M <= N <= 1000
assert sum(A) == N

for i in range(N):
    assert min(T[i]) == 0
    assert max(T[i]) == M-1
    assert len(set(T[i])) == M

    
nok = [i for i in range(N)]
ans = [None] * N

for k in range(M):

    new_nok = []

    for j in nok:
        
        nt = T[j][k]
        if A[nt] > 0:
            A[nt] -= 1
            ans[j] = nt

        else:
            new_nok.append(j)

    nok = new_nok

assert None not in ans

print (*ans)
0