結果
| 問題 |
No.2320 Game World for PvP
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2023-05-27 23:09:45 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 769 bytes |
| コンパイル時間 | 1,853 ms |
| コンパイル使用メモリ | 113,860 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 05:26:13 |
| 合計ジャッジ時間 | 3,085 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
#include <atcoder/maxflow>
int main() {
cin.tie(nullptr), ios::sync_with_stdio(false);
int N, S, T;
cin >> N >> S >> T;
const int gs = N, gt = gs + 1;
atcoder::mf_graph<long long> mf(gt + 1);
constexpr long long inf = 1LL << 40;
while (S--) {
int e;
cin >> e;
mf.add_edge(gs, e - 1, inf);
}
while (T--) {
int r;
cin >> r;
mf.add_edge(r - 1, gt, inf);
}
long long ret = 0;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
int c;
cin >> c;
if (i <= j) ret += c;
mf.add_edge(i, j, c);
}
}
cout << ret - mf.flow(gs, gt) << endl;
}
hitonanode