結果
| 問題 |
No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2022-12-09 00:33:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 755 bytes |
| コンパイル時間 | 2,104 ms |
| コンパイル使用メモリ | 195,228 KB |
| 最終ジャッジ日時 | 2025-02-09 06:40:35 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 37 TLE * 12 |
ソースコード
#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;
}
umezo