結果
問題 | No.2453 Seat Allocation |
ユーザー |
![]() |
提出日時 | 2023-09-02 00:05:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 82,792 KB |
実行使用メモリ | 106,836 KB |
最終ジャッジ日時 | 2024-06-11 17:53:28 |
合計ジャッジ時間 | 5,416 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 1 |
ソースコード
import sys input = sys.stdin.readline from heapq import * N,M=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) idxs = [1]*N heap = [ (-a/B[0],i) for i,a in enumerate(A)] heapify(heap) while M: _,i = heappop(heap) print(i+1) M-=1 j = idxs[i] idxs[i] = j+1 if j<len(B): b = B[j] a = A[i] heappush(heap, (-a/b, i))