結果

問題 No.177 制作進行の宮森あおいです!
ユーザー makichan
提出日時 2025-01-30 00:42:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,042 bytes
コンパイル時間 5,595 ms
コンパイル使用メモリ 332,616 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-30 00:43:39
合計ジャッジ時間 6,481 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::static_modint<998244353>;
//using mint = atcoder::static_modint<1000000007>;
using namespace std;
using namespace atcoder;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<n; i++)
const vector<int> dx{1,0,-1,0},dy{0,1,0,-1};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int w;cin >> w;
    int n;cin >> n;
    vector<int> j(n+1);rep(i,1,n+1)cin >> j[i];
    int m;cin >> m;
    vector<int> c(m+1);rep(i,1,m+1)cin >> c[i];
    mf_graph<int> G(n+m+2);
    rep(i,1,n+1)G.add_edge(0,i,j[i]);
    rep(i,1,m+1)G.add_edge(n+i,n+m+1,c[i]);
    
    rep(i,1,m+1){
        int Q;
        cin >> Q;
        vector<bool> good(n+1,true);
        rep(j,0,Q){
            int x;cin >> x;
            good[x]=false;
        }
        rep(j,1,n+1)if(good[j]){
            G.add_edge(j,n+i,10000);
        }
    }
    if(G.flow(0,n+m+1)<w)cout << "BANSAKUTSUKITA\n";
    else cout << "SHIROBAKO\n";
}
0