結果

問題 No.2762 Counting and Deleting
ユーザー tailstails
提出日時 2024-05-23 19:04:42
言語 cLay
(20240420-1)
結果
AC  
実行時間 538 ms / 4,000 ms
コード長 528 bytes
コンパイル時間 5,117 ms
コンパイル使用メモリ 198,228 KB
実行使用メモリ 27,784 KB
最終ジャッジ日時 2024-05-23 19:04:55
合計ジャッジ時間 10,383 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
7,616 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 515 ms
24,192 KB
testcase_08 AC 530 ms
24,064 KB
testcase_09 AC 506 ms
27,784 KB
testcase_10 AC 538 ms
26,176 KB
testcase_11 AC 346 ms
25,288 KB
testcase_12 AC 332 ms
24,344 KB
testcase_13 AC 364 ms
24,064 KB
testcase_14 AC 378 ms
26,052 KB
testcase_15 AC 200 ms
14,508 KB
testcase_16 AC 199 ms
14,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 998244353
#define M _1
struct M;;
#undef M
using M=Matrix<Mint>;

M segtree_rh_merge(M a,M b){
	return b*a;
}
M segtree_rh_apply(int,M a){
	return a=1;
}
int segtree_rh_compose(int,int){
	return 0;
}

{
	ll@n,@q;
	string@s;
	segtree_rh<M,int>t;
	t.malloc(n);
	t.setN(n,0,0);
	M m0(3,3),m1(3,3);
	m0=1;
	m0[0][1]=1;
	m1=1;
	m1[1][0]=1;
	m1[1][2]=1;
	rep(i,n){
		t[i]=s[i]=='0'?m0:m1;
	}
	t.build();
	rep(q){
		int@y,@l--,@r;
		if(y==1){
			t.change(l,r,0);
		}else{
			M z=t.get(l,r);
			wt(z[0][2]+z[1][2]);
		}
	}
}
0