結果

問題 No.1675 Strange Minimum Query
ユーザー tailstails
提出日時 2021-09-10 23:00:21
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 569 bytes
コンパイル時間 5,680 ms
コンパイル使用メモリ 211,312 KB
実行使用メモリ 17,692 KB
最終ジャッジ日時 2023-09-19 02:41:18
合計ジャッジ時間 11,383 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,952 KB
testcase_01 AC 3 ms
9,464 KB
testcase_02 AC 3 ms
9,512 KB
testcase_03 AC 31 ms
12,988 KB
testcase_04 AC 27 ms
13,668 KB
testcase_05 AC 7 ms
10,968 KB
testcase_06 AC 35 ms
12,800 KB
testcase_07 AC 36 ms
13,236 KB
testcase_08 AC 3 ms
9,576 KB
testcase_09 AC 3 ms
9,608 KB
testcase_10 AC 22 ms
14,476 KB
testcase_11 AC 9 ms
11,148 KB
testcase_12 AC 25 ms
14,344 KB
testcase_13 AC 34 ms
14,876 KB
testcase_14 AC 27 ms
14,544 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

using P=pair<ll,pair<ll,ll>>;
P a[2d5];
ll s[2d5];
ll z[2d5];
{
	ll@n,@q;
	rep(i,q){
		ll@l,@r,@b;
		a[i]={-b,{r,l-1}};
	}
	sortA(q,a);
	ll fb=0,fi=0;
	rep(i,q){
		ll b=-a[i].first;
		ll l=a[i].second.second;
		ll r=a[i].second.first;
		ll f=(fb==b&&fi>=l);
		while(1){
			ll t=l;
			while(t<r&&s[t]){
				t=s[t];
			}
			if(t>=r){
				if(l!=t){
					s[l]=t;
				}
				break;
			}
			f=1;
			l=t;
			s[l]=l+1;
			z[l]=b;
			if(!(fb==b&&fi>=l)){
				fb=b;
				fi=l;
			}
		}
		if(!f){
			wt(-1);
			exit(0);
		}
	}
	rep(i,n){
		if(!z[i]){
			z[i]=1;
		}
	}
	wt(z(n));
}
0