結果
| 問題 |
No.2453 Seat Allocation
|
| コンテスト | |
| ユーザー |
sotanishy
|
| 提出日時 | 2023-09-01 21:46:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,224 ms / 2,000 ms |
| コード長 | 485 bytes |
| コンパイル時間 | 207 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 129,112 KB |
| 最終ジャッジ日時 | 2025-06-20 01:43:52 |
| 合計ジャッジ時間 | 14,820 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
from fractions import Fraction
from heapq import heappush, heappop
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
heap = []
cnt = [0]*N
for i in range(N):
heappush(heap, (-Fraction(A[i], B[0]), i))
ans = []
for _ in range(M):
v, i = heappop(heap)
ans.append(i+1)
cnt[i] += 1
if cnt[i] < M:
heappush(heap, (-Fraction(A[i], B[cnt[i]]), i))
print(*ans, sep="\n")
sotanishy