結果

問題 No.1675 Strange Minimum Query
ユーザー inksamuraiinksamurai
提出日時 2021-09-10 21:52:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,630 bytes
コンパイル時間 4,820 ms
コンパイル使用メモリ 239,104 KB
実行使用メモリ 27,592 KB
最終ジャッジ日時 2023-09-02 17:00:14
合計ジャッジ時間 10,855 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 65 ms
7,960 KB
testcase_04 AC 76 ms
13,836 KB
testcase_05 AC 39 ms
14,036 KB
testcase_06 AC 77 ms
8,636 KB
testcase_07 AC 98 ms
13,412 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 114 ms
19,972 KB
testcase_11 AC 65 ms
17,040 KB
testcase_12 AC 128 ms
21,528 KB
testcase_13 WA -
testcase_14 AC 196 ms
22,776 KB
testcase_15 AC 203 ms
27,592 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
//eolibraries
#define lnf 3999999999999999999
#define inf 999999999+1
#define fi first
#define se second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define make_unique(a) sort(all(a)),a.erase(unique(all(a)),a.end());
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define crep(i,x,n) for(int i=x;i<n;i++)
#define vec(...) vector<__VA_ARGS__>
#define _3E0svGb ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
//eodefine
using namespace std;
typedef long long ll;
typedef long double ld;
using pii=pair<int,int>;
using tpii=pair<pii,int>;
using vi=vec(int);
const int mxn=12000;

ll op(ll l,ll r){
	return min(l,r);
}

ll e(){
	return lnf;
}

int main(){
_3E0svGb;
	int n,m;
	cin>>n>>m;
	atcoder::segtree<ll,op,e> seg(n);
	rep(i,n) seg.set(i,lnf);
	vec(vec(pii)) qry(n);
	ll mx=0;
	rep(i,m){
		ll l,r,val;
		cin>>l>>r>>val;
		l--,r--;
		mx=max(mx,val);
		qry[r].pb({l,val});	
	}
	mx++;
	set<int> st;
	rep(i,n) st.insert(i);
	rep(i,n){
		sort(all(qry[i]));
		for(auto p : qry[i]){
			ll val=p.se;
			ll now=seg.prod(p.fi,i+1);
			if(now<val){
				printf("-1\n");
				exit(0);
			}else if(now==val){
				continue;
			}
			auto it=st.lower_bound(p.fi);
			if(it==st.end()){
				printf("-1\n");
				exit(0);
			}
			seg.set(*it,val);
			st.erase(it);
		}
	}
	rep(i,n){
		for(auto p : qry[i]){
			ll val=p.se;
			if(seg.prod(p.fi,i+1)!=val){
				printf("-1\n");
				exit(0);
			}
		}
	}
	rep(i,n){
		cout<<(seg.prod(i,i+1)==lnf?mx:seg.prod(i,i+1));
		if(i<n-1) cout<<" ";
	}
	cout<<"\n";
//	
	return 0;
}
0