結果
| 問題 |
No.3017 交互浴
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-03-20 00:56:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 392 bytes |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 82,412 KB |
| 実行使用メモリ | 109,576 KB |
| 最終ジャッジ日時 | 2025-03-20 00:56:40 |
| 合計ジャッジ時間 | 22,562 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 46 TLE * 1 -- * 8 |
ソースコード
def calc(st: list) -> int:
res = 0
l = 0
for h, v in reversed(st):
res += (h - l) * v
l = h
return res
INF = 1 << 60
N = int(input())
H = list(map(int, input().split()))
st = [(INF, 0)]
for i, h in enumerate(H):
v = 1 if i % 2 == 0 else 0 # 1=水色
while st[-1][0] <= h:
st.pop()
st.append((h, v))
res = calc(st)
print(res)
norioc