結果

問題 No.2453 Seat Allocation
ユーザー lloyzlloyz
提出日時 2023-09-04 01:22:24
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 723 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 111,660 KB
最終ジャッジ日時 2023-09-04 01:22:32
合計ジャッジ時間 7,318 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,344 KB
testcase_01 AC 73 ms
71,604 KB
testcase_02 AC 74 ms
71,376 KB
testcase_03 RE -
testcase_04 AC 81 ms
71,160 KB
testcase_05 AC 279 ms
111,660 KB
testcase_06 AC 168 ms
91,240 KB
testcase_07 RE -
testcase_08 AC 149 ms
80,404 KB
testcase_09 AC 404 ms
103,708 KB
testcase_10 AC 361 ms
104,240 KB
testcase_11 AC 375 ms
104,384 KB
testcase_12 AC 264 ms
91,428 KB
testcase_13 AC 251 ms
92,200 KB
testcase_14 AC 140 ms
91,052 KB
testcase_15 AC 294 ms
91,616 KB
testcase_16 AC 295 ms
91,172 KB
testcase_17 AC 83 ms
71,352 KB
testcase_18 AC 296 ms
97,568 KB
testcase_19 AC 355 ms
103,012 KB
testcase_20 AC 222 ms
85,424 KB
testcase_21 AC 259 ms
86,224 KB
testcase_22 AC 288 ms
94,144 KB
testcase_23 AC 74 ms
71,372 KB
testcase_24 AC 74 ms
71,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush

class T(object):
    def __init__(self, bunsi, bunbo, idx):
        self.bunsi = bunsi
        self.bunbo = bunbo
        self.idx = idx
    
    def __lt__(self, other):
        if other.bunbo * self.bunsi == self.bunbo * other.bunsi:
            return other.idx > self.idx
        else:
            return other.bunbo * self.bunsi > self.bunbo * other.bunsi

n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

H = []
for i in range(n):
    heappush(H, T(A[i], B[0], i))
C = [0 for _ in range(n)]
for _ in range(m):
    t = heappop(H)
    idx = t.idx
    print(idx + 1)
    C[idx] += 1
    heappush(H, T(A[idx], B[C[idx]], idx))
0