結果
問題 | No.324 落ちてた閉路グラフ |
ユーザー | roaris |
提出日時 | 2019-12-11 00:03:14 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 87,192 KB |
実行使用メモリ | 849,548 KB |
最終ジャッジ日時 | 2023-09-06 07:57:17 |
合計ジャッジ時間 | 6,325 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 78 ms
71,392 KB |
testcase_01 | AC | 77 ms
71,348 KB |
testcase_02 | AC | 77 ms
71,388 KB |
testcase_03 | AC | 82 ms
71,072 KB |
testcase_04 | MLE | - |
testcase_05 | MLE | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
ソースコード
n, m = map(int, input().split()) w = list(map(int, input().split())) dp = [[[[-10**18]*2 for _ in range(m+1)] for _ in range(2)] for _ in range(n)] dp[0][0][0][0] = 0 dp[0][1][1][1] = 0 for i in range(n-1): for j in range(m+1): for k in range(2): dp[i+1][0][j][k] = max(dp[i][0][j][k], dp[i][1][j][k]) if j+1<=m: dp[i+1][1][j+1][k] = max(dp[i][0][j][k], dp[i][1][j][k]+w[i])+(w[-1] if i==n-2 and k==1 else 0) ans = -10**18 for i in range(2): for j in range(2): ans = max(ans, dp[n-1][i][m][j]) print(ans)