結果
| 問題 |
No.2036 Max Middle
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:14:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 511 bytes |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 93,952 KB |
| 最終ジャッジ日時 | 2025-06-12 21:16:01 |
| 合計ジャッジ時間 | 4,170 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 4 TLE * 1 -- * 12 |
ソースコード
def main():
import sys
input = sys.stdin.read
data = input().split()
N = int(data[0])
A = list(map(int, data[1:N+1]))
operations = 0
i = 0
while i < len(A) - 2:
if A[i] < A[i+1] and A[i+1] > A[i+2]:
min_val = min(A[i], A[i+2])
A[i+1] = min_val - 1
operations += 1
i = max(i - 2, 0) # Check previous positions
else:
i += 1
print(operations)
if __name__ == "__main__":
main()
gew1fw