結果
| 問題 |
No.1460 Max of Min
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:06:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 860 bytes |
| コンパイル時間 | 393 ms |
| コンパイル使用メモリ | 81,612 KB |
| 実行使用メモリ | 85,060 KB |
| 最終ジャッジ日時 | 2025-04-16 00:08:25 |
| 合計ジャッジ時間 | 4,502 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 3 TLE * 1 -- * 83 |
ソースコード
import sys
from collections import deque
def main():
K, N = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))
M = max(B)
# Check if any initial term is >= M
if any(a >= M for a in A):
if N < K:
print(A[N])
else:
print(M)
return
# If N is within the initial terms
if N < K:
print(A[N])
return
# Simulate the sequence until N or until a term >= M is found
current = deque(A)
for i in range(K, N + 1):
new_term = max(min(current[m], B[m]) for m in range(K))
current.popleft()
current.append(new_term)
if new_term >= M:
print(M)
return
print(current[-1])
if __name__ == "__main__":
main()
lam6er