結果

問題 No.1675 Strange Minimum Query
ユーザー aut_jul_duraut_jul_dur
提出日時 2021-09-10 23:49:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,530 bytes
コンパイル時間 3,603 ms
コンパイル使用メモリ 237,564 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2023-09-03 00:18:08
合計ジャッジ時間 14,353 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 243 ms
8,312 KB
testcase_04 AC 213 ms
10,144 KB
testcase_05 AC 18 ms
7,352 KB
testcase_06 AC 292 ms
8,560 KB
testcase_07 AC 307 ms
11,408 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 264 ms
15,300 KB
testcase_14 AC 302 ms
15,400 KB
testcase_15 AC 284 ms
15,684 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 52 ms
5,720 KB
testcase_18 AC 77 ms
5,932 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 267 ms
14,156 KB
testcase_23 AC 224 ms
8,424 KB
testcase_24 AC 189 ms
9,628 KB
testcase_25 AC 137 ms
6,992 KB
testcase_26 WA -
testcase_27 AC 182 ms
12,780 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 273 ms
10,888 KB
testcase_32 AC 353 ms
15,616 KB
testcase_33 AC 348 ms
15,872 KB
testcase_34 AC 357 ms
15,500 KB
testcase_35 AC 338 ms
15,340 KB
testcase_36 AC 349 ms
15,304 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 = 1e10;
const F ID = 1e10;

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 << 1e9 << " ";
      }
      else{
        cout << seg.get(i) << " ";
      }
    }
    if(seg.get(N-1) == INF){
      cout << 1e9 << endl;
    }
    else{
      cout <<seg.get(N-1) << endl;
    }
  }
  return 0;
}
0