結果

問題 No.2453 Seat Allocation
ユーザー mymelochan
提出日時 2023-09-02 17:26:49
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 777 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,196 KB
実行使用メモリ 109,048 KB
最終ジャッジ日時 2024-06-11 23:56:33
合計ジャッジ時間 6,535 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 12 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
L = 10**9
#############################################################

N,M = lmin()
A = lmin()
B = lmin()

cnt = [1]*N
hq = []
for i,a in enumerate(A):
    heappush(hq,(-a/B[0]*L+i,i))

ans = []
while len(ans) < M:
    _,idx = heappop(hq)
    ans.append(idx+1)
    heappush(hq,(-A[idx]/B[cnt[idx]]*L+idx,idx))
    cnt[idx] += 1


for a in ans:
    print(a)
0