結果

問題 No.1675 Strange Minimum Query
ユーザー aut_jul_duraut_jul_dur
提出日時 2021-09-10 23:45:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,478 bytes
コンパイル時間 4,441 ms
コンパイル使用メモリ 237,176 KB
実行使用メモリ 15,544 KB
最終ジャッジ日時 2023-09-02 23:37:05
合計ジャッジ時間 15,734 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 249 ms
8,036 KB
testcase_04 AC 220 ms
10,092 KB
testcase_05 AC 20 ms
7,252 KB
testcase_06 AC 300 ms
8,668 KB
testcase_07 AC 323 ms
11,444 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 137 ms
12,040 KB
testcase_11 WA -
testcase_12 AC 157 ms
12,360 KB
testcase_13 AC 263 ms
15,336 KB
testcase_14 AC 311 ms
15,296 KB
testcase_15 AC 295 ms
15,352 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 51 ms
5,664 KB
testcase_18 AC 75 ms
6,044 KB
testcase_19 WA -
testcase_20 AC 249 ms
13,240 KB
testcase_21 AC 203 ms
13,100 KB
testcase_22 AC 267 ms
14,016 KB
testcase_23 AC 223 ms
8,404 KB
testcase_24 AC 193 ms
9,676 KB
testcase_25 AC 149 ms
7,036 KB
testcase_26 WA -
testcase_27 AC 180 ms
12,992 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 294 ms
11,044 KB
testcase_32 AC 363 ms
15,464 KB
testcase_33 AC 362 ms
15,456 KB
testcase_34 AC 364 ms
15,456 KB
testcase_35 AC 365 ms
15,544 KB
testcase_36 AC 358 ms
15,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const long long MOD = 998244353;
//const long long INF = 9*1e18;
using ll = long long;
using mint = modint998244353;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
long double PI = 3.14159265358979;
using S = long long;
using F = long long;

const S INF = 1e9+1;
const F ID = 1e9+1;

S op(S a, S b){ return std::min(a, b); }
S e(){ return INF; }
S mapping(F f, S x){ return (f == ID ? x : f); }
F composition(F f, F g){ return (f == ID ? g : f); }
F id(){ return ID; }

int main(){
  ll N,Q;
  cin>>N>>Q;
  vector<ll> v;
  v.assign(N,INF);
  lazy_segtree<S,op,e,F,mapping,composition,id> seg(v);
  vector<tuple<ll,ll,ll>> A(Q);
  rep(i,Q){
    ll a,b,c;
    cin>>a>>b>>c;
    a--;
    A[i] = {c,a,b};
  }
  sort(all(A));
  rep(i,Q){
    seg.apply(get<1>(A[i]),get<2>(A[i]),get<0>(A[i]));
  }
  bool d = 0;
  rep(i,Q){
    if(seg.prod(get<1>(A[i]),get<2>(A[i])) != get<0>(A[i])){
      d = 1;
    }
  }
  if(d){
    cout << -1 << endl;
  }
  else{
    rep(i,N-1){
      if(seg.get(i) == INF){
        cout << INF-1 << " ";
      }
      else{
        cout << seg.get(i) << " ";
      }
    }
    cout <<seg.get(N-1);
    cout << endl;
  }
  return 0;
}
       
  
  
0