結果

問題 No.1675 Strange Minimum Query
ユーザー tailstails
提出日時 2021-09-10 22:59:28
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 548 bytes
コンパイル時間 5,700 ms
コンパイル使用メモリ 209,448 KB
実行使用メモリ 21,976 KB
最終ジャッジ日時 2023-09-19 02:40:35
合計ジャッジ時間 11,478 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,600 KB
testcase_01 AC 3 ms
9,624 KB
testcase_02 AC 3 ms
9,568 KB
testcase_03 AC 32 ms
12,996 KB
testcase_04 AC 27 ms
13,788 KB
testcase_05 AC 6 ms
10,916 KB
testcase_06 AC 35 ms
12,744 KB
testcase_07 AC 37 ms
13,240 KB
testcase_08 AC 3 ms
9,580 KB
testcase_09 AC 3 ms
9,728 KB
testcase_10 AC 22 ms
14,144 KB
testcase_11 AC 8 ms
11,148 KB
testcase_12 AC 24 ms
14,308 KB
testcase_13 AC 32 ms
14,812 KB
testcase_14 AC 27 ms
14,816 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){
				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