結果
| 問題 |
No.2604 Initial Motion
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2024-01-12 22:07:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 166 ms / 3,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 4,874 ms |
| コンパイル使用メモリ | 265,056 KB |
| 最終ジャッジ日時 | 2025-02-18 18:21:41 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001
int main(){
int K,N,M;
cin>>K>>N>>M;
mcf_graph<long long,long long> G(N+2);
int S = N;
int T = N+1;
rep(i,K){
long long a;
cin>>a;
a--;
G.add_edge(S,a,1,0);
}
rep(i,N){
long long a;
cin>>a;
G.add_edge(i,T,a,0);
}
rep(i,M){
long long a,b,c;
cin>>a>>b>>c;
a--,b--;
G.add_edge(a,b,K,c);
G.add_edge(b,a,K,c);
}
cout<<G.flow(S,T,K).second<<endl;
return 0;
}
沙耶花