結果

問題 No.2617 容量3のナップザック
ユーザー 👑 p-adicp-adic
提出日時 2023-12-19 21:45:38
言語 cLay
(20240104-1)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 180,668 KB
実行使用メモリ 138,436 KB
最終ジャッジ日時 2023-12-21 23:41:38
合計ジャッジ時間 7,488 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 1 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 151 ms
65,332 KB
testcase_13 AC 132 ms
28,136 KB
testcase_14 AC 143 ms
60,068 KB
testcase_15 AC 87 ms
17,204 KB
testcase_16 AC 134 ms
72,696 KB
testcase_17 AC 121 ms
38,112 KB
testcase_18 AC 117 ms
35,376 KB
testcase_19 AC 21 ms
8,188 KB
testcase_20 AC 120 ms
25,716 KB
testcase_21 AC 73 ms
35,348 KB
testcase_22 AC 134 ms
26,444 KB
testcase_23 AC 153 ms
40,732 KB
testcase_24 AC 8 ms
6,676 KB
testcase_25 AC 106 ms
36,960 KB
testcase_26 AC 158 ms
95,952 KB
testcase_27 AC 62 ms
28,820 KB
testcase_28 AC 6 ms
6,676 KB
testcase_29 AC 56 ms
16,528 KB
testcase_30 AC 126 ms
26,320 KB
testcase_31 AC 125 ms
41,964 KB
testcase_32 AC 150 ms
40,228 KB
testcase_33 AC 165 ms
41,412 KB
testcase_34 AC 187 ms
57,784 KB
testcase_35 AC 188 ms
42,020 KB
testcase_36 AC 256 ms
138,436 KB
testcase_37 AC 182 ms
58,536 KB
testcase_38 AC 147 ms
28,116 KB
testcase_39 AC 191 ms
64,536 KB
testcase_40 AC 192 ms
40,268 KB
testcase_41 AC 85 ms
37,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@N,@K,@s,@a,@b,@m,f[2N]{s},r;REP(i,1,2N)f[i]=(a*f[i-1]+b)%m;vector<ll>v[4];rep(i,N)b=f[i]%3+1,v[b].push_back(-b*f[i+N]);rep(w,1,4){auto&u=v[w];u.push_back(-1d18),sort(u.begin(),u.end()),u[0]=0,b=u.size();rep(i,1,b)(u[i]*=-1)+=u[i-1];while(b<4K)u.push_back(u.back()),b++;}a=v[3][K];rep(k,K){b=K-k,s=0,r=b+1;while(s<r-1)m=(s+r)/2,(v[2][m]-v[2][m-1]<v[1][3b-2m+2]-v[1][3b-2m]?r:s)=m;a>?=v[3][k]+v[2][s]+v[1][3b-2s];}wt(a);
0