結果

問題 No.2291 Union Find Estimate
ユーザー tailstails
提出日時 2023-05-05 22:27:44
言語 cLay
(20240104-1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 4,689 ms
コンパイル使用メモリ 175,924 KB
実行使用メモリ 6,276 KB
最終ジャッジ日時 2023-08-15 05:01:17
合計ジャッジ時間 5,821 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 12 ms
4,380 KB
testcase_03 AC 31 ms
6,276 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 4 ms
4,384 KB
testcase_15 AC 18 ms
5,032 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 4 ms
4,388 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353
ll@w,@h;
unionFind u('m',w,1);
Mint z=Mint(10)**w;
ll b[w];
rep(j,w)b[j]=1023;
rep(h){
	string@q;
	ll a[26]{};
	rep(j,w){
		ll c=q[j];
		ll k=u(j);
		if(c>='0'&&c<='9'){
			c-='0';
			if(b[k]!=1<<c){
				z/=BIT_popcount(b[k]);
				b[k]&=1<<c;
				z*=BIT_popcount(b[k]);
			}
		}
		if(c>='a'&&c<='z'){
			c-='a';
			if(a[c]){
				ll d=u(a[c]-1);
				if(u(d,k)){
					z/=BIT_popcount(b[d]);
					if(b[d]!=b[k]){
						z/=BIT_popcount(b[k]);
						b[u(d)]=b[d]&b[k];
						z*=BIT_popcount(b[u(d)]);
					}
				}
			}else{
				a[c]=k+1;
			}
		}
	}
	wt(z);
}
0