結果
問題 | No.2604 Initial Motion |
ユーザー |
|
提出日時 | 2024-01-12 23:53:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 189 ms / 3,000 ms |
コード長 | 637 bytes |
コンパイル時間 | 4,690 ms |
コンパイル使用メモリ | 268,276 KB |
最終ジャッジ日時 | 2025-02-18 19:21:12 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
#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;}