結果

問題 No.2680 研究室配属
ユーザー shobonvipshobonvip
提出日時 2024-03-20 21:32:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 85,364 KB
最終ジャッジ日時 2024-03-20 21:32:42
合計ジャッジ時間 3,813 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 45 ms
59,972 KB
testcase_04 AC 44 ms
59,960 KB
testcase_05 AC 53 ms
66,460 KB
testcase_06 AC 63 ms
68,536 KB
testcase_07 AC 57 ms
68,532 KB
testcase_08 AC 54 ms
66,464 KB
testcase_09 AC 53 ms
64,264 KB
testcase_10 AC 77 ms
76,288 KB
testcase_11 AC 81 ms
76,416 KB
testcase_12 AC 86 ms
77,300 KB
testcase_13 AC 79 ms
76,416 KB
testcase_14 AC 86 ms
77,312 KB
testcase_15 AC 61 ms
68,404 KB
testcase_16 AC 114 ms
79,604 KB
testcase_17 AC 74 ms
76,160 KB
testcase_18 AC 97 ms
77,568 KB
testcase_19 AC 131 ms
81,140 KB
testcase_20 AC 117 ms
80,116 KB
testcase_21 AC 67 ms
72,504 KB
testcase_22 AC 106 ms
78,708 KB
testcase_23 AC 172 ms
85,364 KB
testcase_24 AC 179 ms
85,236 KB
testcase_25 AC 216 ms
85,364 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)]
seen = [0] * m
adopt = [0] * n
ans = [0] * n

for j in range(m):
	var = [[] for i in range(m)]
	for i in range(n):
		if adopt[i] == 1: continue
		var[t[i][j]].append(i)

	for i in range(m):
		if seen[i] >= a[i]: continue
		left = a[i] - seen[i]
		var[i].sort()
		var[i] = var[i][:min(len(var[i]), left)]
		for x in var[i]:
			adopt[x] = 1
			seen[i] += 1
			ans[x] = i

print(*ans)
0