結果

問題 No.2206 Popcount Sum 2
ユーザー tailstails
提出日時 2023-02-06 11:20:23
言語 cLay
(20240104-1)
結果
AC  
実行時間 533 ms / 4,000 ms
コード長 402 bytes
コンパイル時間 8,985 ms
コンパイル使用メモリ 218,892 KB
実行使用メモリ 16,744 KB
最終ジャッジ日時 2023-09-17 22:59:35
合計ジャッジ時間 16,209 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 122 ms
5,748 KB
testcase_03 AC 128 ms
5,620 KB
testcase_04 AC 129 ms
5,664 KB
testcase_05 AC 532 ms
16,504 KB
testcase_06 AC 532 ms
16,688 KB
testcase_07 AC 533 ms
16,532 KB
testcase_08 AC 532 ms
16,564 KB
testcase_09 AC 532 ms
16,560 KB
testcase_10 AC 367 ms
16,500 KB
testcase_11 AC 367 ms
16,692 KB
testcase_12 AC 368 ms
16,568 KB
testcase_13 AC 374 ms
16,528 KB
testcase_14 AC 375 ms
16,508 KB
testcase_15 AC 376 ms
16,560 KB
testcase_16 AC 349 ms
16,744 KB
testcase_17 AC 349 ms
16,548 KB
testcase_18 AC 347 ms
16,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353

Comb<Mint>h;

int@t,n[t],m[],o[],a[],r[];
rd((n,m)(t));
rep(i,t)o[i]=n[i]/450;
sortA_index(t,o,m,n,a);

int b=0,c=0;
Mint z=1;

rep(i,t){
	ll e=n[i]-1;
	ll f=m[i]-1;
	if(f<c){
		z=1;
		c=0;
		b=e;
	}
	while(b<e){
		z=z*2-h.C(b,c);
		++b;
	}
	while(b>e){
		--b;
		z=(z+h.C(b,c))*(int)(MD+1>>1);
	}
	while(c<f){
		++c;
		z+=h.C(b,c);
	}
	r[a[i]]=z*(Mint(2)**(b+1)-1);
}
wtLn(r(t));
0