結果
| 問題 | 
                            No.2152 [Cherry Anniversary 2]  19 Petals of Cherry
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tails
                         | 
                    
| 提出日時 | 2022-12-09 11:04:32 | 
| 言語 | cLay  (20241019-1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 876 bytes | 
| コンパイル時間 | 2,755 ms | 
| コンパイル使用メモリ | 173,712 KB | 
| 実行使用メモリ | 36,608 KB | 
| 最終ジャッジ日時 | 2024-10-14 18:35:13 | 
| 合計ジャッジ時間 | 7,213 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 1 -- * 48 | 
ソースコード
// tabun TLE suru
char pc[1<<19];
unsigned bs[19];
bool pari(unsigned g,unsigned b){
	bool z=false,y=false;
	while(b){
		if(b&1){
			if(g&1){
				z^=y;
			}else{
				y=!y;
			}
		}
		g>>=1;
		b>>=1;
	}
	return z;
}
pair<ll,ll> f(int s,unsigned b :Memoize[19,524288]){
	pair<ll,ll> z{};
	int d=pc[b];
	if(d==1){
		z.first=b&bs[s]?1:0;
	}else{
		int e=d>>1;
		for(unsigned g=b;g=g-1&b;){
			if(pc[g]==e){
				auto r1=f(s,g);
				auto r2=f(s+e,b^g);
				if(pari(g,b)){
					z.first+=r1.first*r2.second+r1.second*r2.first;
					z.second+=r1.first*r2.first+r1.second*r2.second;
				}else{
					z.first+=r1.first*r2.first+r1.second*r2.second;
					z.second+=r1.first*r2.second+r1.second*r2.first;
				}
			}
		}
	}
	return z;
}
{
	rep(i,1<<19){
		pc[i]=__builtin_popcount(i);
	}
	rep(i,19){
		ll@l;
		rep(l){
			ll@a;
			bs[i]|=1<<a-1;
		}
	}
	auto r=f(0,(1<<19)-1);
	wt(r);
}
            
            
            
        
            
tails