結果
| 問題 |
No.2057 Ising Model
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-28 02:25:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 259 bytes |
| コンパイル時間 | 297 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 127,872 KB |
| 最終ジャッジ日時 | 2024-11-22 15:27:01 |
| 合計ジャッジ時間 | 66,422 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 TLE * 21 |
ソースコード
n, a, b = map(int, input().split()) sgn = [1, -1] dp = [- b * sgn[i] for i in range(2)] for _ in range(n - 1): ndp = [0 for _ in range(2)] ndp[0] = min(dp[0] + a - b, dp[1] - a - b) ndp[1] = min(dp[0] - a + b, dp[1] + a + b) dp = ndp print(min(dp))