結果
| 問題 | No.2453 Seat Allocation |
| コンテスト | |
| ユーザー |
ikoma
|
| 提出日時 | 2023-09-01 23:52:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 616 bytes |
| 記録 | |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 82,144 KB |
| 実行使用メモリ | 211,708 KB |
| 最終ジャッジ日時 | 2025-01-03 13:20:46 |
| 合計ジャッジ時間 | 27,656 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 4 TLE * 6 |
ソースコード
import sys
input = sys.stdin.readline
from heapq import *
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Ai = [(a,i) for i,a in enumerate(A)]
Ai.sort(reverse=True)
a,i = Ai[0]
offset = 1<<40
f = lambda a,b,i: (((a*offset//b)<<20) +M-i)
heap = [ f(a,b,i) for b in B]
heapify(heap)
for a,i in Ai[1:]:
for b in B:
pi = f(a,b,i)
if heap[0]>=pi:break
heappush(heap, pi)
pi2 = heappop(heap)
ans = []
while heap:
pi = heappop(heap)
i = pi & ((1<<20)-1)
i = M-i
ans.append(i+1)
ans = reversed(ans)
print(*ans,sep="\n")
ikoma