結果

問題 No.2453 Seat Allocation
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-09-01 23:10:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 954 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 125,704 KB
最終ジャッジ日時 2023-09-07 15:37:39
合計ジャッジ時間 10,763 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,292 KB
testcase_01 AC 76 ms
71,068 KB
testcase_02 AC 75 ms
71,284 KB
testcase_03 AC 74 ms
71,208 KB
testcase_04 AC 75 ms
71,120 KB
testcase_05 AC 555 ms
125,316 KB
testcase_06 AC 206 ms
91,320 KB
testcase_07 AC 224 ms
103,536 KB
testcase_08 AC 153 ms
80,140 KB
testcase_09 AC 952 ms
124,872 KB
testcase_10 AC 928 ms
125,704 KB
testcase_11 AC 954 ms
125,652 KB
testcase_12 AC 214 ms
91,188 KB
testcase_13 AC 271 ms
91,408 KB
testcase_14 AC 160 ms
91,132 KB
testcase_15 AC 318 ms
91,428 KB
testcase_16 AC 315 ms
90,404 KB
testcase_17 AC 75 ms
70,852 KB
testcase_18 AC 641 ms
112,480 KB
testcase_19 AC 759 ms
118,972 KB
testcase_20 AC 334 ms
91,684 KB
testcase_21 AC 380 ms
93,524 KB
testcase_22 AC 526 ms
105,540 KB
testcase_23 AC 74 ms
71,008 KB
testcase_24 AC 74 ms
71,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop,heappush
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))


inf = 10**20

h = []
num = [0]*n

for i in range(n):
    heappush(h,[-inf*A[i]//B[0],i])

ans = []
for _ in range(m):
    x,ind = heappop(h)
    ans.append(ind+1)

    num[ind] += 1
    if num[ind] >= m:
        continue
    heappush(h,[-inf*A[ind]//B[num[ind]],ind])

for i in ans:
    print(i)
0