結果
| 問題 | No.2680 研究室配属 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-20 21:14:37 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 118 ms / 2,000 ms |
| + 947µs | |
| コード長 | 749 bytes |
| 記録 | |
| コンパイル時間 | 85 ms |
| コンパイル使用メモリ | 64,576 KB |
| 実行使用メモリ | 72,944 KB |
| 最終ジャッジ日時 | 2026-10-16 18:55:27 |
| 合計ジャッジ時間 | 5,198 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
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)