結果

問題 No.2591 安上がりな括弧列
ユーザー 👑 p-adicp-adic
提出日時 2023-12-19 09:28:27
言語 cLay
(20240104-1)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 169 bytes
コンパイル時間 2,646 ms
コンパイル使用メモリ 174,796 KB
実行使用メモリ 54,464 KB
最終ジャッジ日時 2023-12-19 09:28:30
合計ジャッジ時間 3,661 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,616 KB
testcase_01 AC 2 ms
7,616 KB
testcase_02 AC 2 ms
7,616 KB
testcase_03 AC 2 ms
7,616 KB
testcase_04 AC 2 ms
7,616 KB
testcase_05 AC 2 ms
7,616 KB
testcase_06 AC 1 ms
7,616 KB
testcase_07 AC 1 ms
7,616 KB
testcase_08 AC 2 ms
7,616 KB
testcase_09 AC 2 ms
7,744 KB
testcase_10 AC 2 ms
7,616 KB
testcase_11 AC 38 ms
54,464 KB
testcase_12 AC 38 ms
54,464 KB
testcase_13 AC 38 ms
54,464 KB
testcase_14 AC 37 ms
54,464 KB
testcase_15 AC 37 ms
54,464 KB
testcase_16 AC 37 ms
53,568 KB
testcase_17 AC 12 ms
19,392 KB
testcase_18 AC 19 ms
29,632 KB
testcase_19 AC 14 ms
24,128 KB
testcase_20 AC 36 ms
54,336 KB
testcase_21 AC 37 ms
54,464 KB
testcase_22 AC 37 ms
54,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@N;string@S;ll@A[2N],D[3N][2N],L=1d18,b;REP(j,N+1)D[0][j]=j?L:0;REP(i,2N)REP(j,N+1)b=S[i]>'(',D[i+1][j]=min(j?D[i][j-1]+b*A[i]:L,j<N?D[i][j+1]+!b*A[i]:L);wt(D[2N][0]);
0