結果

問題 No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
ユーザー umezoumezo
提出日時 2022-12-09 00:52:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 819 bytes
コンパイル時間 2,353 ms
コンパイル使用メモリ 197,408 KB
実行使用メモリ 204,004 KB
最終ジャッジ日時 2024-04-22 18:51:14
合計ジャッジ時間 28,721 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
163,456 KB
testcase_01 AC 336 ms
200,064 KB
testcase_02 AC 43 ms
44,416 KB
testcase_03 AC 741 ms
200,064 KB
testcase_04 AC 525 ms
194,560 KB
testcase_05 AC 519 ms
200,320 KB
testcase_06 AC 558 ms
194,688 KB
testcase_07 AC 510 ms
196,224 KB
testcase_08 AC 568 ms
191,744 KB
testcase_09 AC 446 ms
196,352 KB
testcase_10 AC 564 ms
199,168 KB
testcase_11 AC 547 ms
200,064 KB
testcase_12 AC 413 ms
200,064 KB
testcase_13 AC 441 ms
193,152 KB
testcase_14 AC 501 ms
195,968 KB
testcase_15 AC 550 ms
198,272 KB
testcase_16 AC 447 ms
198,016 KB
testcase_17 AC 505 ms
200,320 KB
testcase_18 AC 530 ms
196,096 KB
testcase_19 AC 539 ms
200,320 KB
testcase_20 AC 372 ms
188,160 KB
testcase_21 AC 457 ms
196,224 KB
testcase_22 AC 505 ms
198,784 KB
testcase_23 AC 448 ms
195,968 KB
testcase_24 AC 641 ms
200,320 KB
testcase_25 AC 455 ms
200,192 KB
testcase_26 AC 579 ms
200,320 KB
testcase_27 AC 467 ms
196,096 KB
testcase_28 AC 200 ms
163,200 KB
testcase_29 AC 229 ms
183,680 KB
testcase_30 AC 241 ms
193,024 KB
testcase_31 AC 253 ms
197,248 KB
testcase_32 AC 270 ms
199,040 KB
testcase_33 AC 300 ms
199,808 KB
testcase_34 AC 335 ms
200,064 KB
testcase_35 AC 362 ms
200,064 KB
testcase_36 AC 416 ms
200,320 KB
testcase_37 AC 466 ms
200,192 KB
testcase_38 AC 518 ms
200,320 KB
testcase_39 AC 573 ms
200,192 KB
testcase_40 AC 653 ms
200,192 KB
testcase_41 AC 712 ms
200,320 KB
testcase_42 AC 774 ms
200,320 KB
testcase_43 AC 857 ms
200,192 KB
testcase_44 AC 950 ms
203,956 KB
testcase_45 TLE -
testcase_46 TLE -
testcase_47 AC 42 ms
44,544 KB
testcase_48 AC 596 ms
192,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

ll dp[20][530000][2];
int B[1<<19][20];
int x=(1<<19)-1;
vector<int> A[20];
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  for(int i=0;i<(1<<19);i++){
    int cnt=0;
    for(int j=18;j>=0;j--){
      if(i&(1<<j)) cnt++;
      B[i][j]=cnt;
    }
  }
  
  rep(i,19){
    int l;
    cin>>l;
    rep(_,l){
      int a;
      cin>>a;
      a--;
      A[i+1].push_back(a);
    }
  }
  
  dp[0][0][0]=1;
  for(int i=1;i<=19;i++){
    rep(j,1<<19){
      for(auto a:A[i]){
        if(j&(1<<a)) continue;
        rep(k,2) dp[i][j|(1<<a)][(k+B[j][a+1])%2]+=dp[i-1][j][k];
      }
    }
  }
  cout<<dp[19][x][0]<<" "<<dp[19][x][1]<<endl;
  
  return 0;
}
0