結果

問題 No.1234 典型RMQ
ユーザー tailstails
提出日時 2020-10-06 10:36:03
言語 cLay
(20240104-1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 718 bytes
コンパイル時間 2,590 ms
コンパイル使用メモリ 167,160 KB
実行使用メモリ 12,780 KB
最終ジャッジ日時 2023-09-19 01:30:21
合計ジャッジ時間 19,214 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
12,780 KB
testcase_01 AC 2 ms
5,384 KB
testcase_02 AC 2 ms
5,560 KB
testcase_03 AC 2 ms
5,516 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,448 KB
testcase_06 AC 807 ms
10,280 KB
testcase_07 AC 194 ms
9,792 KB
testcase_08 AC 1,014 ms
10,636 KB
testcase_09 AC 592 ms
10,136 KB
testcase_10 AC 924 ms
10,352 KB
testcase_11 AC 769 ms
10,208 KB
testcase_12 AC 523 ms
10,020 KB
testcase_13 AC 216 ms
9,804 KB
testcase_14 AC 554 ms
10,044 KB
testcase_15 AC 428 ms
9,956 KB
testcase_16 AC 908 ms
10,440 KB
testcase_17 AC 552 ms
10,116 KB
testcase_18 AC 92 ms
9,944 KB
testcase_19 AC 993 ms
10,484 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 座標圧縮してあとは愚直

int cc(int n, int arr[], ll values[], void *mem = wmem){
	int i;
	int k = 0;
	int j;
	pair<int,int>*r;
	walloc1d(&r, n, &mem);
	for(i=(0);i<(n);i++){
		r[i].first = arr[i];
		r[i].second = i;
	}
	sort(r, r+n);
	j=r[0].first;
	for(i=(0);i<(n);i++){
		if(i && r[i].first != j){
			values[k]=values[j];
			while(++j<r[i].first){
				values[k]<?=values[j];
			}
			k++;
		}
		arr[r[i].second] = k;
	}
	return k+1;
}

int n,q,k[1d5],lr[2d5],c[1d5];
ll a[1d5];

{
	rd(n,a(n),q);
	rep(i,q){
		rd(k[i],lr[2i]--,lr[2i+1],c[i]);
	}
	cc(2q,lr,a);
	rep(i,q){
		if(k[i]==1){
			REP(j,lr[2i],lr[2i+1]) a[j]+=c[i];
		}else{
			ll z=ll_inf;
			REP(j,lr[2i],lr[2i+1]) z<?=a[j];
			wt(z);
		}
	}
}
0