結果

問題 No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
ユーザー hotman78hotman78
提出日時 2022-12-09 07:19:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 787 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 195,852 KB
実行使用メモリ 7,748 KB
最終ジャッジ日時 2024-04-22 19:01:16
合計ジャッジ時間 6,116 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
7,552 KB
testcase_01 AC 62 ms
7,680 KB
testcase_02 AC 52 ms
7,660 KB
testcase_03 WA -
testcase_04 AC 61 ms
7,644 KB
testcase_05 WA -
testcase_06 AC 62 ms
7,516 KB
testcase_07 AC 59 ms
7,656 KB
testcase_08 AC 58 ms
7,480 KB
testcase_09 AC 58 ms
7,552 KB
testcase_10 WA -
testcase_11 AC 56 ms
7,552 KB
testcase_12 AC 58 ms
7,552 KB
testcase_13 AC 57 ms
7,528 KB
testcase_14 AC 59 ms
7,596 KB
testcase_15 AC 59 ms
7,552 KB
testcase_16 AC 63 ms
7,652 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 59 ms
7,680 KB
testcase_21 AC 62 ms
7,432 KB
testcase_22 AC 62 ms
7,648 KB
testcase_23 AC 57 ms
7,616 KB
testcase_24 WA -
testcase_25 AC 64 ms
7,416 KB
testcase_26 WA -
testcase_27 AC 58 ms
7,552 KB
testcase_28 AC 51 ms
7,680 KB
testcase_29 AC 53 ms
7,552 KB
testcase_30 AC 56 ms
7,552 KB
testcase_31 AC 54 ms
7,552 KB
testcase_32 AC 54 ms
7,524 KB
testcase_33 AC 53 ms
7,524 KB
testcase_34 AC 54 ms
7,508 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 48 ms
7,580 KB
testcase_48 AC 60 ms
7,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

int main(){
    constexpr int n=19;
    array<int,n>l;
    array<bitset<n>,n>a;
    rep(i,n){
        a[n-1-i]=bitset<n>();
        cin>>l[n-1-i];
        rep(j,l[n-1-i]){
            int x;
            cin>>x;
            x--;
            a[n-1-i][x]=1;
        }
    }
    array<array<int,(1<<n)>,2>dp;
    rep(i,2)dp[i].fill(0);
    dp[0][0]=1;
    rep(d,(1<<n)-1){
        bool cnt=0;
        int k=__builtin_popcount(d);
        rep(j,n){
            if(d>>j&1){
                cnt^=1;
            }else{
                if(a[k][j]){
                    rep(t,2)dp[t^cnt][d+(1<<j)]+=dp[t][d];
                }
            }
        }
    }
    cout<<dp[0][(1<<n)-1]<<" "<<dp[1][(1<<n)-1]<<endl;
}
0