結果

問題 No.1460 Max of Min
ユーザー Shinya Fujita
提出日時 2024-12-17 00:52:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 74,096 KB
最終ジャッジ日時 2024-12-17 00:53:01
合計ジャッジ時間 10,432 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54 WA * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

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(3*K+1):
    A.append(calc())


try:
    print(A[N])
except:
    memo = []
    for a in A[::-1]:
        if memo and memo[0]==a:
            break
        memo.append(a)
    m = len(memo)
    n = len(A)
    d = N+1 - n
    d %= m
    print(memo[::-1][d-1])
0