結果

問題 No.1675 Strange Minimum Query
ユーザー googol_S0googol_S0
提出日時 2021-09-10 22:19:50
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 364 ms / 2,000 ms
コード長 1,007 bytes
コンパイル時間 4,802 ms
コンパイル使用メモリ 269,812 KB
実行使用メモリ 10,476 KB
最終ジャッジ日時 2023-09-02 18:22:48
合計ジャッジ時間 16,116 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 220 ms
5,860 KB
testcase_04 AC 195 ms
7,012 KB
testcase_05 AC 17 ms
5,856 KB
testcase_06 AC 258 ms
6,216 KB
testcase_07 AC 276 ms
7,808 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 135 ms
8,640 KB
testcase_11 AC 35 ms
7,856 KB
testcase_12 AC 149 ms
8,608 KB
testcase_13 AC 268 ms
10,284 KB
testcase_14 AC 316 ms
10,476 KB
testcase_15 AC 288 ms
10,416 KB
testcase_16 AC 2 ms
4,368 KB
testcase_17 AC 52 ms
4,688 KB
testcase_18 AC 76 ms
5,004 KB
testcase_19 AC 101 ms
8,432 KB
testcase_20 AC 236 ms
9,096 KB
testcase_21 AC 206 ms
9,292 KB
testcase_22 AC 271 ms
9,688 KB
testcase_23 AC 222 ms
6,120 KB
testcase_24 AC 193 ms
6,724 KB
testcase_25 AC 143 ms
5,428 KB
testcase_26 AC 69 ms
6,004 KB
testcase_27 AC 180 ms
8,904 KB
testcase_28 AC 93 ms
8,112 KB
testcase_29 AC 65 ms
8,104 KB
testcase_30 AC 66 ms
5,856 KB
testcase_31 AC 290 ms
7,572 KB
testcase_32 AC 364 ms
10,352 KB
testcase_33 AC 362 ms
10,156 KB
testcase_34 AC 363 ms
10,284 KB
testcase_35 AC 357 ms
10,232 KB
testcase_36 AC 356 ms
10,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
struct S{
  int a;
};
struct F{
  int a;
  bool f;
};
S op(S a,S b){
  return S{min(a.a,b.a)};
}
S e(){
  return S{1000000000};
}
S mapping(F f,S x){
  if(f.f){
    return S{f.a};
  }
  return x;
}
F composition(F f,F g){
  if(f.f){
    return f;
  }
  return g;
}
F id(){
  return F{0,false};
}
int main(){
  int N,Q;
  cin>>N>>Q;
  vector<pair<int,pair<int,int>>> A(Q);
  lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
  for(int i=0;i<Q;i++){
    cin>>A[i].second.first>>A[i].second.second>>A[i].first;
    A[i].second.first--;
  }
  sort(A.begin(),A.end());
  for(int i=0;i<Q;i++){
    seg.apply(A[i].second.first,A[i].second.second,F{A[i].first,true});
  }
  for(int i=0;i<Q;i++){
    if(seg.prod(A[i].second.first,A[i].second.second).a!=A[i].first){
      cout<<"-1\n";
      return 0;
    }
  }
  for(int i=0;i<N;i++){
    if(i){
      cout<<" ";
    }
    cout<<seg.get(i).a;
  }
  cout<<"\n";
}
0