結果
| 問題 |
No.1460 Max of Min
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:34:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 956 bytes |
| コンパイル時間 | 219 ms |
| コンパイル使用メモリ | 81,856 KB |
| 実行使用メモリ | 58,624 KB |
| 最終ジャッジ日時 | 2025-06-12 21:35:04 |
| 合計ジャッジ時間 | 4,807 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 TLE * 1 -- * 87 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
ptr = 0
K = int(input[ptr])
ptr += 1
N = int(input[ptr])
ptr += 1
A = list(map(int, input[ptr:ptr+K]))
ptr += K
B = list(map(int, input[ptr:ptr+K]))
ptr += K
if N < K:
print(A[N])
return
c = max(B)
j_list = [j for j in range(K) if B[j] == c]
current_window = A.copy()
for i in range(K, N + 1):
found = False
for j in j_list:
if current_window[j] >= c:
found = True
break
if found:
if i <= N:
print(c)
return
else:
min_values = [min(current_window[j], B[j]) for j in range(K)]
A_i = max(min_values)
current_window.pop(0)
current_window.append(A_i)
if i == N:
print(A_i)
return
main()
gew1fw