結果

問題 No.2453 Seat Allocation
ユーザー tassei903tassei903
提出日時 2023-09-01 22:55:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 117,584 KB
最終ジャッジ日時 2023-09-07 15:37:06
合計ジャッジ時間 8,726 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,168 KB
testcase_01 AC 76 ms
71,172 KB
testcase_02 AC 76 ms
71,248 KB
testcase_03 AC 80 ms
71,256 KB
testcase_04 AC 76 ms
71,256 KB
testcase_05 AC 373 ms
117,084 KB
testcase_06 AC 183 ms
92,292 KB
testcase_07 AC 185 ms
95,692 KB
testcase_08 AC 159 ms
79,660 KB
testcase_09 AC 705 ms
117,004 KB
testcase_10 AC 661 ms
117,584 KB
testcase_11 AC 580 ms
117,276 KB
testcase_12 AC 239 ms
91,940 KB
testcase_13 AC 242 ms
92,140 KB
testcase_14 AC 164 ms
91,932 KB
testcase_15 AC 286 ms
91,300 KB
testcase_16 AC 372 ms
91,364 KB
testcase_17 AC 77 ms
71,148 KB
testcase_18 AC 428 ms
100,248 KB
testcase_19 AC 488 ms
110,696 KB
testcase_20 AC 248 ms
88,524 KB
testcase_21 AC 276 ms
88,000 KB
testcase_22 AC 365 ms
96,732 KB
testcase_23 AC 77 ms
71,168 KB
testcase_24 AC 77 ms
71,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n,m = na()
a = na()
b = na()
big  = 10 ** 20
def f(x, y):
    return -((x * big * 2 + y) // (y * 2) )

from heapq import *
hq = []
for i in range(n):
    heappush(hq, (f(a[i], b[0]), i))
c = [1] * n
ans = [-1] * m
for i in range(m):
    x, y = heappop(hq)
    #print(x)
    ans[i] = y + 1
    if c[y] < m:
        heappush(hq, (f(a[y], b[c[y]]), y))
        c[y] += 1
    
print(*ans,sep="\n")
0