結果
問題 |
No.2453 Seat Allocation
|
ユーザー |
|
提出日時 | 2023-09-02 13:37:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,045 ms / 2,000 ms |
コード長 | 362 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 42,928 KB |
最終ジャッジ日時 | 2025-06-20 01:48:56 |
合計ジャッジ時間 | 10,984 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
from decimal import Decimal from heapq import * n, m = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) d = [1] * n h = [(-Decimal(x) / b[0], i) for i, x in enumerate(a)] heapify(h) while m: _, k = heappop(h) print(k + 1) m -= 1 j = d[k] d[k] = j + 1 if j < len(b): heappush(h, (-Decimal(a[k]) / b[j], k))