結果
問題 |
No.1460 Max of Min
|
ユーザー |
![]() |
提出日時 | 2025-04-16 16:34:57 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 860 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 81,812 KB |
実行使用メモリ | 61,412 KB |
最終ジャッジ日時 | 2025-04-16 16:37:52 |
合計ジャッジ時間 | 5,135 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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()