結果

問題 No.2680 研究室配属
ユーザー noriocnorioc
提出日時 2024-03-20 22:57:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,724 KB
最終ジャッジ日時 2024-03-20 22:58:16
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 42 ms
59,976 KB
testcase_04 AC 43 ms
59,972 KB
testcase_05 AC 48 ms
64,136 KB
testcase_06 AC 49 ms
64,116 KB
testcase_07 AC 51 ms
66,192 KB
testcase_08 AC 51 ms
64,128 KB
testcase_09 AC 50 ms
64,140 KB
testcase_10 AC 70 ms
76,160 KB
testcase_11 AC 70 ms
76,160 KB
testcase_12 AC 75 ms
76,148 KB
testcase_13 AC 72 ms
76,160 KB
testcase_14 AC 78 ms
76,160 KB
testcase_15 AC 59 ms
68,392 KB
testcase_16 AC 105 ms
79,348 KB
testcase_17 AC 71 ms
76,160 KB
testcase_18 AC 90 ms
77,312 KB
testcase_19 AC 118 ms
80,500 KB
testcase_20 AC 109 ms
79,476 KB
testcase_21 AC 65 ms
72,360 KB
testcase_22 AC 101 ms
78,452 KB
testcase_23 AC 159 ms
84,724 KB
testcase_24 AC 159 ms
84,724 KB
testcase_25 AC 171 ms
84,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

tab = []
for _ in range(N):
    tab.append(list(map(int, input().split())))

rooms = [0] * M
ans = [-1] * N
used = set()

for k in range(M):  # 第 k 希望
    for i in range(N):  # 学生
        if i in used: continue
        r = tab[i][k]
        if rooms[r] + 1 <= A[r]:
            ans[i] = r
            rooms[r] += 1
            used.add(i)

print(*ans)
0