結果

問題 No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
ユーザー umezoumezo
提出日時 2022-12-09 00:33:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 755 bytes
コンパイル時間 2,130 ms
コンパイル使用メモリ 198,804 KB
実行使用メモリ 162,396 KB
最終ジャッジ日時 2024-04-22 18:49:16
合計ジャッジ時間 42,455 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
122,240 KB
testcase_01 AC 398 ms
159,104 KB
testcase_02 AC 13 ms
5,376 KB
testcase_03 TLE -
testcase_04 AC 853 ms
153,600 KB
testcase_05 AC 846 ms
159,232 KB
testcase_06 AC 911 ms
153,856 KB
testcase_07 AC 811 ms
155,392 KB
testcase_08 AC 892 ms
150,784 KB
testcase_09 AC 669 ms
155,520 KB
testcase_10 AC 866 ms
158,336 KB
testcase_11 AC 872 ms
159,232 KB
testcase_12 AC 625 ms
159,360 KB
testcase_13 AC 660 ms
152,192 KB
testcase_14 AC 921 ms
155,264 KB
testcase_15 AC 884 ms
157,184 KB
testcase_16 AC 691 ms
157,056 KB
testcase_17 AC 802 ms
159,360 KB
testcase_18 AC 901 ms
155,008 KB
testcase_19 AC 871 ms
159,360 KB
testcase_20 AC 511 ms
147,456 KB
testcase_21 AC 739 ms
155,008 KB
testcase_22 AC 746 ms
157,696 KB
testcase_23 AC 694 ms
155,264 KB
testcase_24 TLE -
testcase_25 AC 737 ms
159,360 KB
testcase_26 AC 931 ms
161,888 KB
testcase_27 AC 760 ms
155,008 KB
testcase_28 AC 114 ms
122,368 KB
testcase_29 AC 182 ms
142,720 KB
testcase_30 AC 248 ms
152,192 KB
testcase_31 AC 312 ms
156,160 KB
testcase_32 AC 383 ms
158,208 KB
testcase_33 AC 456 ms
158,592 KB
testcase_34 AC 546 ms
159,104 KB
testcase_35 AC 650 ms
159,232 KB
testcase_36 AC 741 ms
159,360 KB
testcase_37 AC 833 ms
159,104 KB
testcase_38 AC 953 ms
162,136 KB
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 AC 13 ms
5,376 KB
testcase_48 TLE -
権限があれば一括ダウンロードができます

ソースコード

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