結果
問題 |
No.3201 Corporate Synergy
|
ユーザー |
![]() |
提出日時 | 2025-07-11 21:58:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 749 bytes |
コンパイル時間 | 4,256 ms |
コンパイル使用メモリ | 257,360 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-07-11 21:58:21 |
合計ジャッジ時間 | 4,871 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 WA * 13 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000005 #define Inf64 4000000000000000001LL int main(){ int n; cin>>n; mf_graph<long long> G(n+2); int S = n,T = n+1; long long ans = 0; rep(i,n){ long long p; cin>>p; if(p>=0){ ans += p; G.add_edge(S,i,p); } else{ G.add_edge(i,T,-p); } } int m; cin>>m; rep(i,m){ int u,v; cin>>u>>v; u--,v--; G.add_edge(u,v,Inf64); } int k; cin>>k; rep(_,k){ int a,b,c; cin>>a>>b>>c; ans += c; a--,c--; G.add_edge(S,a,c); G.add_edge(b,a,c); } ans -= G.flow(S,T); cout<<ans<<endl; return 0; }