結果
| 問題 |
No.2604 Initial Motion
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-12 22:58:07 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 850 bytes |
| コンパイル時間 | 6,226 ms |
| コンパイル使用メモリ | 326,828 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-27 23:44:46 |
| 合計ジャッジ時間 | 8,741 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 RE * 8 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, k;
cin >> k >> n >> m;
vector<int> a(n, 0);
for(int i = 0; i < k; i++){
int x;
cin >> x;
a[x - 1]++;
}
vector<int> b(n);
for(int i = 0; i < n; i++){
cin >> b[i];
}
mcf_graph<int, ll> g(n + 2);
int S = n;
int T = n + 1;
for(int i = 0; i < n; i++){
g.add_edge(S, i, a[i], 0);
g.add_edge(i, T, b[i], 0);
}
for(int i = 0; i < m; i++){
int s, t, d;
cin >> s>>t>>d;
s--; t--;
g.add_edge(s, t, k, d);
g.add_edge(t, s, k, d);
}
pair<int, ll> f = g.flow(S, T, k);
cout << f.second << endl;
return 0;
}