結果

問題 No.1675 Strange Minimum Query
ユーザー otoshigootoshigo
提出日時 2021-09-17 17:23:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,624 bytes
コンパイル時間 4,834 ms
コンパイル使用メモリ 267,860 KB
実行使用メモリ 18,132 KB
最終ジャッジ日時 2023-09-12 04:25:51
合計ジャッジ時間 17,619 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 285 ms
14,324 KB
testcase_04 AC 243 ms
15,644 KB
testcase_05 AC 18 ms
5,536 KB
testcase_06 AC 339 ms
15,604 KB
testcase_07 AC 349 ms
16,200 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 159 ms
11,188 KB
testcase_11 AC 33 ms
7,060 KB
testcase_12 AC 174 ms
11,308 KB
testcase_13 AC 295 ms
17,992 KB
testcase_14 AC 345 ms
17,680 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 58 ms
5,404 KB
testcase_18 AC 90 ms
6,404 KB
testcase_19 AC 108 ms
8,788 KB
testcase_20 AC 291 ms
13,364 KB
testcase_21 AC 245 ms
11,852 KB
testcase_22 AC 333 ms
16,664 KB
testcase_23 AC 284 ms
15,156 KB
testcase_24 AC 239 ms
10,400 KB
testcase_25 AC 179 ms
9,000 KB
testcase_26 AC 79 ms
7,292 KB
testcase_27 AC 212 ms
11,416 KB
testcase_28 AC 104 ms
8,652 KB
testcase_29 AC 65 ms
7,540 KB
testcase_30 AC 73 ms
6,168 KB
testcase_31 AC 374 ms
15,828 KB
testcase_32 AC 462 ms
17,780 KB
testcase_33 AC 459 ms
17,636 KB
testcase_34 AC 465 ms
17,544 KB
testcase_35 AC 452 ms
17,480 KB
testcase_36 AC 458 ms
17,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;  using vvi = vector<vi>;
using vl = vector<ll>;   using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>;
using vm = vector<mint>; using vvm = vector<vm>;
using vpi = vector<pii>; using vvpi = vector<vpi>;
using vpl = vector<pll>; using vvpl = vector<vpl>;
const int inf = 1e9;
const ll INF = 1LL << 60;
#define rep(i,m,n) for (int i = m; i < (int)(n); i++)
#define rrep(i,m,n) for (int i = m; i > (int)(n); i--)

using S = int;
using F = int;
S op(S a, S b){ return min(a, b); }
S e(){ return inf; }
S mapping(F f, S x){ return (f == inf ? x : f); }
F composition(F f, F g){ return (f == inf ? g : f);}
F id(){ return inf; }

int main(){
    int n,q; cin >> n >> q;
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);
    vvi vec;
    rep(_,0,q){
        int l,r,b; cin >> l >> r >> b; --l;
        vec.push_back({b,l,r});
    }
    sort(vec.begin(),vec.end());
    //reverse(vec.begin(),vec.end());
    rep(i,0,q){
        int b = vec[i][0],l = vec[i][1],r = vec[i][2];
        seg.apply(l,r,b);
    }
    rep(i,0,q){
        int b = vec[i][0],l = vec[i][1],r = vec[i][2];
        if (seg.prod(l,r) != b){
            cout << -1 << endl;
            return 0;
        }
    }
    rep(i,0,n){
        cout << seg.get(i);
        if (i != n-1){
            cout << " ";
        }
    }
    cout << endl;
}
0