結果

問題 No.1615 Double Down
ユーザー monnu
提出日時 2021-07-21 23:47:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 652 bytes
コンパイル時間 3,797 ms
コンパイル使用メモリ 247,360 KB
実行使用メモリ 29,540 KB
最終ジャッジ日時 2024-07-17 20:46:31
合計ジャッジ時間 29,980 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 3 -- * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
#define MAX 100
#define MOD 1000000007
#define INF 1000000000

int main(){
  int N,M,K,L;
  cin>>N>>M>>K>>L;
  mcf_graph<int,ll> G(N+M+2);
  for(int i=0;i<L;i++){
    int X,Y,Z;
    cin>>X>>Y>>Z;
    G.add_edge(X,N+Y,1,(1LL<<32)-(1LL<<Z));
  }
  for(int i=0;i<N;i++){
    G.add_edge(0,i+1,1,0);
    G.add_edge(i+1,N+M+1,1,(1LL<<32));
  }
  for(int i=0;i<M;i++){
    G.add_edge(N+i+1,N+M+1,1,0);
  }
  pair<int,ll> p=G.flow(0,N+M+1);
  ll ans=(ll)p.first*(1LL<<32)-p.second;
  cout<<ans<<endl;
}
0