結果
| 問題 |
No.2713 Just Solitaire
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-27 01:23:29 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 838 bytes |
| コンパイル時間 | 4,107 ms |
| コンパイル使用メモリ | 286,052 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-27 01:23:35 |
| 合計ジャッジ時間 | 5,163 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()
#include <atcoder/maxflow>
using namespace atcoder;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int N, M;
cin >> N >> M;
ll sum = 0;
mf_graph<ll> G(N + M + 2);
rep(i, 0, N) {
ll A;
cin >> A;
G.add_edge(N + M, i, A);
}
rep(i, 0, M) {
ll B;
cin >> B;
sum += B;
G.add_edge(i + N, N + M + 1, B);
}
rep(i, 0, M) {
int K;
cin >> K;
rep(j, 0, K) {
int C;
cin >> C;
--C;
G.add_edge(C, N + i, 1ll << 60);
}
}
cout << sum - G.flow(N + M, N + M + 1) << '\n';
}