結果

問題 No.1675 Strange Minimum Query
ユーザー TKTYITKTYI
提出日時 2021-09-10 21:42:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 1,173 bytes
コンパイル時間 5,309 ms
コンパイル使用メモリ 228,948 KB
実行使用メモリ 15,668 KB
最終ジャッジ日時 2023-09-02 16:33:11
合計ジャッジ時間 15,204 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 212 ms
7,760 KB
testcase_04 AC 196 ms
10,184 KB
testcase_05 AC 27 ms
7,280 KB
testcase_06 AC 252 ms
8,716 KB
testcase_07 AC 275 ms
11,372 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 138 ms
11,972 KB
testcase_11 AC 37 ms
10,336 KB
testcase_12 AC 150 ms
12,496 KB
testcase_13 AC 273 ms
15,396 KB
testcase_14 AC 330 ms
15,512 KB
testcase_15 AC 299 ms
15,668 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 52 ms
5,764 KB
testcase_18 AC 76 ms
6,012 KB
testcase_19 AC 107 ms
11,600 KB
testcase_20 AC 238 ms
13,284 KB
testcase_21 AC 209 ms
13,292 KB
testcase_22 AC 276 ms
14,100 KB
testcase_23 AC 219 ms
8,332 KB
testcase_24 AC 195 ms
9,680 KB
testcase_25 AC 143 ms
7,012 KB
testcase_26 AC 70 ms
7,596 KB
testcase_27 AC 187 ms
12,876 KB
testcase_28 AC 95 ms
11,280 KB
testcase_29 AC 67 ms
10,908 KB
testcase_30 AC 67 ms
7,608 KB
testcase_31 AC 290 ms
10,932 KB
testcase_32 AC 372 ms
15,424 KB
testcase_33 AC 375 ms
15,396 KB
testcase_34 AC 379 ms
15,424 KB
testcase_35 AC 369 ms
15,512 KB
testcase_36 AC 363 ms
15,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef long double ld;
#define FOR(i,l,r) for(ll i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,l,r) for(ll i=r-1;i>=l;i--)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
#define BS(A,x) binary_search(ALL(A),x)
#define LB(A,x) (ll)(lower_bound(ALL(A),x)-A.begin())
#define UB(A,x) (ll)(upper_bound(ALL(A),x)-A.begin())
#define COU(A,x) UB(A,x)-LB(A,x)
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
using mint=modint1000000007;
ll op(ll a,ll b){return min(a,b);}
ll e(){return 1e18;}
ll mapping(ll f,ll x){return max(f,x);}
ll composition(ll f,ll g){return max(f,g);}
ll id(){return -1;}
signed main(){
  ll N,Q;cin>>N>>Q;vector<ll>l(Q),r(Q),B(Q),A(N,1);REP(i,Q)cin>>l[i]>>r[i]>>B[i];
  lazy_segtree<ll,op,e,ll,mapping,composition,id>seg(A);
  REP(i,Q)seg.apply(l[i]-1,r[i],B[i]);REP(i,N)A[i]=seg.get(i);
  REP(i,Q)if(seg.prod(l[i]-1,r[i])!=B[i]){cout<<-1<<endl;return 0;}
  REP(i,N-1)cout<<A[i]<<" ";cout<<A[N-1]<<endl;
  return 0;
}
0