結果
| 問題 | No.2854 -1 Subsequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-25 15:00:10 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| + 277µs | |
| コード長 | 183 bytes |
| 記録 | |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 96,108 KB |
| 実行使用メモリ | 117,248 KB |
| 最終ジャッジ日時 | 2026-07-16 10:37:40 |
| 合計ジャッジ時間 | 5,669 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
ソースコード
n = int(input())
A = list(map(int, input().split()))
x = -(1 << 60)
y = -(1 << 60)
for a in A:
nx = max(x, y + a)
ny = max(y, x - a, -a)
x, y = nx, ny
print(max(x, y))