結果
問題 |
No.2036 Max Middle
|
ユーザー |
![]() |
提出日時 | 2025-06-12 19:12:26 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 456 bytes |
コンパイル時間 | 352 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 107,196 KB |
最終ジャッジ日時 | 2025-06-12 19:12:31 |
合計ジャッジ時間 | 4,828 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 4 TLE * 1 -- * 12 |
ソースコード
def max_operations(): import sys input = sys.stdin.read().split() n = int(input[0]) a = list(map(int, input[1:n+1])) ops = 0 i = 0 while i <= n-3: 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 ops += 1 i = max(i-1, 0) # 检查前面的位置是否满足条件 else: i += 1 print(ops) max_operations()