結果

問題 No.2697 Range LIS Query
ユーザー tailstails
提出日時 2024-03-27 11:23:54
言語 cLay
(20240104-1)
結果
AC  
実行時間 230 ms / 10,000 ms
コード長 717 bytes
コンパイル時間 4,665 ms
コンパイル使用メモリ 191,712 KB
実行使用メモリ 24,568 KB
最終ジャッジ日時 2024-03-27 11:24:03
合計ジャッジ時間 8,050 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,488 KB
testcase_01 AC 3 ms
7,488 KB
testcase_02 AC 2 ms
7,488 KB
testcase_03 AC 8 ms
7,872 KB
testcase_04 AC 7 ms
7,872 KB
testcase_05 AC 7 ms
8,000 KB
testcase_06 AC 193 ms
24,312 KB
testcase_07 AC 188 ms
24,312 KB
testcase_08 AC 189 ms
24,312 KB
testcase_09 AC 103 ms
24,440 KB
testcase_10 AC 102 ms
24,440 KB
testcase_11 AC 103 ms
24,440 KB
testcase_12 AC 151 ms
23,288 KB
testcase_13 AC 139 ms
22,104 KB
testcase_14 AC 188 ms
22,392 KB
testcase_15 AC 230 ms
24,568 KB
testcase_16 AC 230 ms
24,568 KB
testcase_17 AC 225 ms
24,568 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:340:23: warning: narrowing conversion of ‘x’ from ‘long long int’ to ‘int’ [-Wnarrowing]
  340 |       t.change(l-1,r,{x});
      |                       ^

ソースコード

diff #

struct V{
	int l;
	int h[4][4];
};

struct F{
	int a;
};

inline
V segtree_rh_merge(V a, V b){
	V r;
	r.l=a.l+b.l;
	rep(u,4){
		rep(v,4){
			r.h[u][v]=0;
			rep(w,u,v+1){
				r.h[u][v]>?=a.h[u][w]+b.h[w][v];
			}
		}
	}
	return r;
}

inline
V segtree_rh_apply(F f, V a){
	V r;
	r.l=a.l;
	rep(u,4){
		rep(v,4){
			r.h[u][v]=u<=f.a&&f.a<=v?r.l:0;
		}
	}
	return r;
}

inline
F segtree_rh_compose(F f, F g){
	return f;
}

{
	segtree_rh<V,F>t;
	ll@n;
	t.malloc(n,1);
	rep(i,n){
		ll@a--;
		t[i].l=1;
		rep(u,4){
			rep(v,4){
				t[i].h[u][v]=u<=a&&a<=v;
			}
		}
	}
	t.build();
	ll@q;
	rep(q){
		ll@y;
		if(y==1){
			ll@l,@r;
			wt(t.get(l-1,r).h[0][3]);
		}
		if(y==2){
			ll@l,@r,@x--;
			t.change(l-1,r,{x});
		}
	}
}
0