結果

問題 No.2320 Game World for PvP
ユーザー 👑 amentorimaru
提出日時 2023-04-15 19:48:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 3,097 ms
コンパイル使用メモリ 155,768 KB
最終ジャッジ日時 2025-02-12 08:58:02
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <iostream>
using namespace std;
using ll = long long;

int main() {
  ll n, s, t;
  cin >> n >> s >> t;
  atcoder::mf_graph<ll> mf(n + 2);
  while(s--) {
    ll e;
    cin >> e;
    mf.add_edge(n, e - 1, 1e18);
  }
  while(t--) {
    ll r;
    cin >> r;
    mf.add_edge(r - 1, n + 1, 1e18);
  }
  ll sum = 0;
  for (ll i = 0; i< n; i++) {
    for (ll j = 0; j< n; j++) {
      ll c;
      cin >> c;
      mf.add_edge(i, j, c);
      sum += c;
    }
  }
  cout << sum / 2 - mf.flow(n, n + 1);
  return 0;
}

0