結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,600 KB
testcase_01 AC 46 ms
55,600 KB
testcase_02 AC 43 ms
55,600 KB
testcase_03 AC 46 ms
61,516 KB
testcase_04 AC 48 ms
61,516 KB
testcase_05 AC 49 ms
63,620 KB
testcase_06 AC 50 ms
65,668 KB
testcase_07 AC 50 ms
65,680 KB
testcase_08 AC 51 ms
65,680 KB
testcase_09 AC 49 ms
63,632 KB
testcase_10 AC 87 ms
76,420 KB
testcase_11 AC 67 ms
76,432 KB
testcase_12 AC 72 ms
76,420 KB
testcase_13 AC 68 ms
76,432 KB
testcase_14 AC 73 ms
76,420 KB
testcase_15 AC 53 ms
65,680 KB
testcase_16 AC 96 ms
79,748 KB
testcase_17 AC 68 ms
76,560 KB
testcase_18 AC 81 ms
77,572 KB
testcase_19 AC 108 ms
81,028 KB
testcase_20 AC 99 ms
79,876 KB
testcase_21 AC 67 ms
70,436 KB
testcase_22 AC 88 ms
78,852 KB
testcase_23 AC 143 ms
84,356 KB
testcase_24 AC 136 ms
84,356 KB
testcase_25 AC 153 ms
85,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################

N,M = lmin()
A = lmin()
T = [lmin() for _ in range(N)]

ans = [-1]*N
R = list(range(N))
TT = [[] for _ in range(N)]
for i in range(2*N):
    if not R:
        break
    NR = []
    
    for r in R:
        tar = T[r][i]
        if len(TT[tar]) == A[tar]:
            NR.append(r)
        else:
            TT[tar].append(r)
            ans[r] = tar
    R = NR

print(*ans)
0