結果
| 問題 |
No.2854 -1 Subsequence
|
| コンテスト | |
| ユーザー |
わん
|
| 提出日時 | 2024-09-01 14:10:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 264 bytes |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 82,228 KB |
| 実行使用メモリ | 104,312 KB |
| 最終ジャッジ日時 | 2024-09-01 14:10:32 |
| 合計ジャッジ時間 | 5,576 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 WA * 10 |
ソースコード
N = int(input())
A = list(map(int, input().split()))
INF = float('inf')
s = [0, -INF, -INF, -INF]
for a in A:
ns = s[:]
ns[0] = max(s[0], s[2])
ns[1] = max(s[1], s[3])
ns[2] = max(s[1] + a, s[3] + a)
ns[3] = max(s[0] - a, s[2] - a)
s = ns
print(max(s))
わん