結果

問題 No.845 最長の切符
ユーザー yuruhiyayuruhiya
提出日時 2020-10-20 18:39:25
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 1,882 ms
コンパイル使用メモリ 165,732 KB
実行使用メモリ 15,884 KB
最終ジャッジ日時 2023-09-19 01:40:44
合計ジャッジ時間 4,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
5,552 KB
testcase_03 AC 2 ms
5,732 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 RE -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

vector<ll> to[16],cost[16];
ll dp[1d5][16];
{
	ll@n, @m;
	rep(m){
		ll@u,@v,@c;
		to[u].push_back(v);
		cost[u].push_back(c);
		to[v].push_back(u);
		cost[v].push_back(c);
	}
	dp[0..(1<<n)-1][0...n]=-1;
	dp[1<<(0..n-1)][0..]=0;
	rep(s,1<<n)rep(v,n)if(dp[s][v]!=-1){
		rep(i,to[v].size())if(!(s&1<<to[v][i]))dp[s|1<<to[v][i]][to[v][i]] >?= dp[s][v]+cost[v][i];
	}
	ll ans=0;
	ans >?= dp[0..(1<<n)-1][0...n];
	wt(ans);
}
0