結果
| 問題 |
No.1460 Max of Min
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-27 15:45:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,089 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 135,076 KB |
| 最終ジャッジ日時 | 2024-12-27 15:46:20 |
| 合計ジャッジ時間 | 27,834 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 RE * 40 |
ソースコード
K, N = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
def calc():
res = -10**18
for i in range(1, K+1):
res = max(res, min(A[-i], B[-i]))
return res
for _ in range(K):
A.append(calc())
if N <= len(A)-1:
print(A[N])
quit()
from heapq import heappop, heappush
def check(x):
AA = [a>=x for a in A]
T = []
for i, b in enumerate(B):
if b >= x:
T.append(K - i)
t0 = T[0]
Min = [-1] * t0
hq = []
for i in range(K, 2*K):
if AA[i]:
heappush(hq, (i, i%t0))
while hq:
i, pos = heappop(hq)
if Min[pos] != -1:
continue
Min[pos] = i
for t in T:
ii = (i+t) % t0
if Min[ii] == -1:
heappush(hq, (i+t, ii))
return 0 <= Min[N%t0] <= N
S = sorted(set(A + B))
if check(S[-1]):
print(S[-1])
quit()
ok = 0
ng = len(S) - 1
while ok+1 < ng:
mid = (ok + ng) // 2
if check(S[mid]):
ok = mid
else:
ng = mid
print(S[ok])