結果

問題 No.1675 Strange Minimum Query
ユーザー kotatsugamekotatsugame
提出日時 2021-09-10 21:30:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 19,832 KB
最終ジャッジ日時 2023-09-02 16:00:49
合計ジャッジ時間 10,839 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,508 KB
testcase_01 AC 4 ms
9,564 KB
testcase_02 AC 4 ms
9,472 KB
testcase_03 AC 169 ms
13,772 KB
testcase_04 AC 169 ms
14,116 KB
testcase_05 AC 17 ms
10,968 KB
testcase_06 AC 207 ms
14,128 KB
testcase_07 AC 221 ms
15,192 KB
testcase_08 AC 4 ms
9,508 KB
testcase_09 AC 5 ms
9,568 KB
testcase_10 AC 103 ms
14,000 KB
testcase_11 AC 25 ms
11,836 KB
testcase_12 AC 110 ms
14,232 KB
testcase_13 AC 202 ms
15,184 KB
testcase_14 AC 240 ms
19,832 KB
testcase_15 AC 221 ms
15,100 KB
testcase_16 AC 5 ms
9,496 KB
testcase_17 AC 42 ms
10,940 KB
testcase_18 AC 61 ms
11,148 KB
testcase_19 AC 79 ms
13,692 KB
testcase_20 AC 181 ms
15,236 KB
testcase_21 AC 163 ms
15,080 KB
testcase_22 AC 204 ms
16,144 KB
testcase_23 AC 179 ms
13,000 KB
testcase_24 AC 155 ms
13,956 KB
testcase_25 AC 111 ms
11,932 KB
testcase_26 AC 56 ms
11,744 KB
testcase_27 AC 140 ms
14,596 KB
testcase_28 AC 72 ms
13,240 KB
testcase_29 AC 48 ms
12,540 KB
testcase_30 AC 55 ms
11,720 KB
testcase_31 AC 230 ms
14,480 KB
testcase_32 AC 297 ms
17,548 KB
testcase_33 AC 281 ms
17,400 KB
testcase_34 AC 296 ms
17,212 KB
testcase_35 AC 291 ms
16,616 KB
testcase_36 AC 295 ms
16,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:11:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   11 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<atcoder/segtree>
using namespace std;
int op(int a,int b){return a<b?a:b;}
int e(){return 2e9;}
int N,Q;
vector<pair<int,int> >L[2<<17];
main()
{
	cin>>N>>Q;
	for(int i=0;i<Q;i++)
	{
		int l,r,b;cin>>l>>r>>b;
		L[l-1].push_back(make_pair(b,r));
	}
	priority_queue<pair<int,int> >P;
	vector<int>A(N);
	P.push(make_pair(1,N));
	for(int l=0;l<N;l++)
	{
		while(P.top().second<=l)P.pop();
		for(pair<int,int>p:L[l])P.push(p);
		A[l]=P.top().first;
	}
	atcoder::segtree<int,op,e>Q(A);
	for(int l=0;l<N;l++)
	{
		for(pair<int,int>p:L[l])
		{
			int r=p.second,b=p.first;
			if(Q.prod(l,r)!=b)
			{
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	for(int i=0;i<N;i++)cout<<A[i]<<(i+1==N?"\n":" ");
}
0