結果

問題 No.1675 Strange Minimum Query
ユーザー tailstails
提出日時 2021-09-10 23:18:53
言語 cLay
(20240104-1)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 5,793 ms
コンパイル使用メモリ 211,592 KB
実行使用メモリ 14,760 KB
最終ジャッジ日時 2023-09-19 02:40:06
合計ジャッジ時間 11,748 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,564 KB
testcase_01 AC 3 ms
9,700 KB
testcase_02 AC 3 ms
9,520 KB
testcase_03 AC 30 ms
12,928 KB
testcase_04 AC 26 ms
13,572 KB
testcase_05 AC 6 ms
10,788 KB
testcase_06 AC 34 ms
12,700 KB
testcase_07 AC 36 ms
13,200 KB
testcase_08 AC 3 ms
9,452 KB
testcase_09 AC 3 ms
9,608 KB
testcase_10 AC 22 ms
14,148 KB
testcase_11 AC 8 ms
11,144 KB
testcase_12 AC 24 ms
14,316 KB
testcase_13 AC 34 ms
14,512 KB
testcase_14 AC 26 ms
14,508 KB
testcase_15 AC 26 ms
14,760 KB
testcase_16 AC 3 ms
9,448 KB
testcase_17 AC 11 ms
10,992 KB
testcase_18 AC 14 ms
13,136 KB
testcase_19 AC 18 ms
14,236 KB
testcase_20 AC 35 ms
14,248 KB
testcase_21 AC 32 ms
14,440 KB
testcase_22 AC 39 ms
14,504 KB
testcase_23 AC 33 ms
13,484 KB
testcase_24 AC 29 ms
14,084 KB
testcase_25 AC 23 ms
13,448 KB
testcase_26 AC 13 ms
11,088 KB
testcase_27 AC 29 ms
14,676 KB
testcase_28 AC 16 ms
13,752 KB
testcase_29 AC 13 ms
11,632 KB
testcase_30 AC 12 ms
11,112 KB
testcase_31 AC 41 ms
13,712 KB
testcase_32 AC 53 ms
14,580 KB
testcase_33 AC 51 ms
14,624 KB
testcase_34 AC 52 ms
14,580 KB
testcase_35 AC 54 ms
14,760 KB
testcase_36 AC 55 ms
14,572 KB
権限があれば一括ダウンロードができます

ソースコード

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];
			}
			while(l!=t){
				(s[l],l)=(t,s[l]);
			}
			if(l>=r){
				break;
			}
			f=1;
			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