結果
| 問題 |
No.2680 研究室配属
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-20 21:14:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 166 ms / 2,000 ms |
| コード長 | 749 bytes |
| コンパイル時間 | 691 ms |
| コンパイル使用メモリ | 82,244 KB |
| 実行使用メモリ | 87,016 KB |
| 最終ジャッジ日時 | 2024-09-30 07:00:50 |
| 合計ジャッジ時間 | 3,368 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd
n,m = map(int,input().split())
a = list(map(int,input().split()))
t = [list(map(int,input().split()))[::-1] for i in range(n)]
now = [[] for i in range(m)]
left = [i for i in range(n)]
for i in range(m):
for i in left:
if not t[i]: continue
x = t[i].pop()
now[x].append(i)
new = []
for i in range(m):
while len(now[i]) > a[i]:
new.append(now[i].pop())
left = new
left.sort()
ans = [0]*n
for i in range(m):
for j in now[i]:
ans[j] = i
print(*ans)