結果
問題 |
No.2036 Max Middle
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:22:49 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 511 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 82,968 KB |
実行使用メモリ | 97,912 KB |
最終ジャッジ日時 | 2025-06-12 16:23:03 |
合計ジャッジ時間 | 4,250 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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()