結果
| 問題 |
No.1460 Max of Min
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:09:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 998 bytes |
| コンパイル時間 | 223 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 84,484 KB |
| 最終ジャッジ日時 | 2025-04-16 00:10:26 |
| 合計ジャッジ時間 | 4,317 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 3 TLE * 1 -- * 83 |
ソースコード
def main():
import sys
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)
if N < K:
print(A[N])
return
if any(a >= M for a in A):
print(M)
return
current = A.copy()
max_steps = K * K + K # Arbitrary large enough steps to detect stabilization
for i in range(K, max_steps + 1):
next_val = max(min(current[j], B[j]) for j in range(K))
if next_val == M:
print(M)
return
current.pop(0)
current.append(next_val)
if all(x == current[0] for x in current):
x = current[0]
print(x if x <= M else M)
return
if i == N:
print(next_val)
return
# If not stabilized, which shouldn't happen for the problem's constraints
print(current[-1])
if __name__ == "__main__":
main()
lam6er