結果
問題 | No.2152 [Cherry Anniversary 2] 19 Petals of Cherry |
ユーザー |
|
提出日時 | 2022-12-09 21:15:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 60 ms / 1,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 552 ms |
コンパイル使用メモリ | 64,076 KB |
実行使用メモリ | 11,836 KB |
最終ジャッジ日時 | 2024-10-14 18:53:01 |
合計ジャッジ時間 | 4,685 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 49 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream>using namespace std;int A[19];long dp[1<<19][2];main(){for(int i=0;i<19;i++){int N;cin>>N;for(;N--;){int a;cin>>a;A[i]|=1<<a-1;}}dp[0][0]=1;for(int i=0;i+1<1<<19;i++){int c=__builtin_popcount(i);int t=0;for(int j=19;j--;){if(i>>j&1)t^=1;else if(A[c]>>j&1){dp[i|1<<j][t]+=dp[i][0];dp[i|1<<j][!t]+=dp[i][1];}}}cout<<dp[(1<<19)-1][0]<<" "<<dp[(1<<19)-1][1]<<endl;}