結果

問題 No.2680 研究室配属
ユーザー OhnoHirokiOhnoHiroki
提出日時 2024-03-21 00:11:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 490 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 1,055 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 42,112 KB
最終ジャッジ日時 2024-03-21 00:11:31
合計ジャッジ時間 4,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,984 KB
testcase_01 AC 29 ms
9,984 KB
testcase_02 AC 29 ms
9,984 KB
testcase_03 AC 29 ms
9,984 KB
testcase_04 AC 31 ms
9,984 KB
testcase_05 AC 34 ms
10,112 KB
testcase_06 AC 37 ms
10,240 KB
testcase_07 AC 34 ms
10,240 KB
testcase_08 AC 34 ms
10,240 KB
testcase_09 AC 33 ms
10,112 KB
testcase_10 AC 62 ms
12,416 KB
testcase_11 AC 59 ms
11,776 KB
testcase_12 AC 76 ms
13,568 KB
testcase_13 AC 61 ms
11,264 KB
testcase_14 AC 77 ms
13,440 KB
testcase_15 AC 35 ms
10,368 KB
testcase_16 AC 139 ms
23,040 KB
testcase_17 AC 48 ms
10,880 KB
testcase_18 AC 94 ms
14,976 KB
testcase_19 AC 169 ms
27,776 KB
testcase_20 AC 144 ms
22,784 KB
testcase_21 AC 42 ms
10,496 KB
testcase_22 AC 115 ms
16,768 KB
testcase_23 AC 259 ms
42,112 KB
testcase_24 AC 264 ms
42,112 KB
testcase_25 AC 490 ms
42,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 00:02:29 2024

@author: Tekyla
"""

#from sys import stdin
#input = lambda :stdin.readline()[:-1]

from collections import deque

N,M = map(int, input().split())
A = list(map(int, input().split()))
ans = [-1 for _ in range(N)]

T = [list(map(int, input().split())) for _ in range(N)]
i = 0
d1 = deque(list(range(N)))
d2 = deque()
while d1:
    while d1:
        student = d1.popleft()
        t = T[student][i]
        if A[t] > 0:
            ans[student] = t
            A[t] -= 1
        else:
            d2.append(student)
    d1 = d2
    d2 = deque()
    i += 1

print(*ans)
0