結果

問題 No.177 制作進行の宮森あおいです!
ユーザー cleaskycleasky
提出日時 2024-02-04 01:38:19
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,182 bytes
コンパイル時間 7,096 ms
コンパイル使用メモリ 263,092 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-04 01:38:28
合計ジャッジ時間 5,696 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,676 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/maxflow>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    cin.tie(0)->sync_with_stdio(0);

    int W;
    cin >> W;
    int N;
    cin >> N;
    vector<int> J(N);
    for (int i = 0; i < N; i++) {
        cin >> J[i];
    }
    int M;
    cin >> M;
    vector<int> C(M);
    for (int i = 0; i < M; i++) {
        cin >> C[i];
    }
    vector<vector<int>> X(M);
    for (int i = 0; i < M; i++) {
        int Q;
        cin >> Q;
        for (int j = 0; j < Q; j++) {
            int x;
            cin >> x;
            x--;
            X[i].push_back(x);
        }
        sort(begin(X[i]), end(X[i]));
    }

    atcoder::mf_graph<int> G(N + M + 2);
    int S = N + M;
    int T = N + M + 1;
    for (int i = 0; i < N; i++) {
        G.add_edge(S, i, INT_MAX);
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            if (!binary_search(begin(X[j]), end(X[j]), i)) {
                G.add_edge(i, N + j, J[i]);
            }
        }
    }
    for (int i = 0; i < M; i++) {
        G.add_edge(N + i, T, C[i]);
    }
    int flow = G.flow(S, T);
    cout << (flow >= W ? "SHIROBAKO" : "BANSAKUTSUKITA") << endl;
}
0