結果

問題 No.2453 Seat Allocation
ユーザー chineristACchineristAC
提出日時 2023-09-01 23:49:20
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 563 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 106,040 KB
最終ジャッジ日時 2023-09-02 11:15:09
合計ジャッジ時間 9,405 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
74,872 KB
testcase_01 AC 107 ms
74,688 KB
testcase_02 AC 105 ms
74,756 KB
testcase_03 AC 107 ms
74,640 KB
testcase_04 AC 109 ms
75,056 KB
testcase_05 AC 382 ms
105,404 KB
testcase_06 AC 228 ms
95,148 KB
testcase_07 AC 226 ms
95,136 KB
testcase_08 AC 194 ms
83,984 KB
testcase_09 AC 528 ms
106,040 KB
testcase_10 AC 509 ms
104,468 KB
testcase_11 AC 510 ms
104,868 KB
testcase_12 AC 284 ms
95,048 KB
testcase_13 AC 294 ms
95,488 KB
testcase_14 AC 213 ms
95,180 KB
testcase_15 AC 336 ms
95,152 KB
testcase_16 AC 341 ms
94,832 KB
testcase_17 AC 110 ms
74,572 KB
testcase_18 AC 415 ms
103,516 KB
testcase_19 AC 452 ms
101,904 KB
testcase_20 AC 277 ms
89,920 KB
testcase_21 AC 303 ms
94,396 KB
testcase_22 AC 373 ms
102,060 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random
from itertools import permutations
from collections import deque
from heapq import *

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,M = mi()
A = li()
B = li()

select = []
idx = [0 for i in range(N)]
t = 10**18
pq = [(-A[i]*t/B[0],i) for i in range(N)]
heapify(pq)
while len(select) < M:
    val,i = heappop(pq)
    select.append((i,idx[i]))
    idx[i] += 1
    if idx[i] < M:
        val = -A[i]*t/B[idx[i]]
        heappush(pq,(val,i))


for i,j in select:
    print(i+1)






0