結果
| 問題 | No.2453 Seat Allocation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-04 01:22:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 723 bytes |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 82,428 KB |
| 実行使用メモリ | 110,364 KB |
| 最終ジャッジ日時 | 2024-06-22 01:25:42 |
| 合計ジャッジ時間 | 5,350 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 RE * 2 |
ソースコード
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))