結果

問題 No.2604 Initial Motion
ユーザー cho435cho435
提出日時 2024-01-12 23:53:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 185 ms / 3,000 ms
コード長 637 bytes
コンパイル時間 5,495 ms
コンパイル使用メモリ 281,816 KB
実行使用メモリ 36,096 KB
最終ジャッジ日時 2024-01-12 23:53:14
合計ジャッジ時間 9,946 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 7 ms
6,676 KB
testcase_04 AC 7 ms
6,676 KB
testcase_05 AC 6 ms
6,676 KB
testcase_06 AC 6 ms
6,676 KB
testcase_07 AC 6 ms
6,676 KB
testcase_08 AC 7 ms
6,676 KB
testcase_09 AC 6 ms
6,676 KB
testcase_10 AC 6 ms
6,676 KB
testcase_11 AC 7 ms
6,676 KB
testcase_12 AC 7 ms
6,676 KB
testcase_13 AC 115 ms
22,656 KB
testcase_14 AC 83 ms
11,904 KB
testcase_15 AC 47 ms
12,288 KB
testcase_16 AC 101 ms
18,944 KB
testcase_17 AC 150 ms
35,200 KB
testcase_18 AC 133 ms
30,336 KB
testcase_19 AC 129 ms
27,264 KB
testcase_20 AC 101 ms
17,536 KB
testcase_21 AC 83 ms
12,672 KB
testcase_22 AC 126 ms
27,392 KB
testcase_23 AC 93 ms
13,696 KB
testcase_24 AC 109 ms
20,864 KB
testcase_25 AC 102 ms
35,968 KB
testcase_26 AC 98 ms
16,384 KB
testcase_27 AC 77 ms
10,112 KB
testcase_28 AC 91 ms
14,464 KB
testcase_29 AC 112 ms
22,144 KB
testcase_30 AC 79 ms
11,264 KB
testcase_31 AC 98 ms
16,128 KB
testcase_32 AC 62 ms
16,512 KB
testcase_33 AC 185 ms
36,096 KB
testcase_34 AC 50 ms
36,096 KB
testcase_35 AC 114 ms
36,096 KB
testcase_36 AC 79 ms
36,096 KB
testcase_37 AC 30 ms
12,288 KB
testcase_38 AC 2 ms
6,676 KB
testcase_39 AC 3 ms
6,676 KB
testcase_40 AC 163 ms
36,096 KB
testcase_41 AC 166 ms
36,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;

int main(){
	int k,n,m;
	cin>>k>>n>>m;
	vector<int> a(k),b(n);
	rep(i,k) cin>>a.at(i);
	rep(i,n) cin>>b.at(i);
	rep(i,k) a.at(i)--;
	vector<vector<ll>> g(n,vector<ll>(n,1e18));
	atcoder::mcf_graph<ll,ll> mcf(n+2);
	rep(lp,m){
		int u,v;
		ll d;
		cin>>u>>v>>d;
		u--; v--;
		mcf.add_edge(u,v,k*2,d);
		mcf.add_edge(v,u,k*2,d);
	}
	rep(i,k) mcf.add_edge(n,a.at(i),1,0);
	rep(i,n) mcf.add_edge(i,n+1,b.at(i),0);
	auto[mx,cs]=mcf.flow(n,n+1,k);
	cout<<cs<<endl;
}
0