結果

問題 No.1675 Strange Minimum Query
ユーザー otoshigootoshigo
提出日時 2021-09-17 17:41:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 466 ms / 2,000 ms
コード長 1,637 bytes
コンパイル時間 4,726 ms
コンパイル使用メモリ 269,024 KB
実行使用メモリ 18,380 KB
最終ジャッジ日時 2023-09-12 04:26:16
合計ジャッジ時間 17,700 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 280 ms
14,616 KB
testcase_04 AC 240 ms
15,984 KB
testcase_05 AC 18 ms
5,288 KB
testcase_06 AC 339 ms
15,196 KB
testcase_07 AC 347 ms
16,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 165 ms
11,364 KB
testcase_11 AC 37 ms
6,780 KB
testcase_12 AC 182 ms
11,184 KB
testcase_13 AC 307 ms
17,636 KB
testcase_14 AC 355 ms
17,708 KB
testcase_15 AC 324 ms
18,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 62 ms
5,524 KB
testcase_18 AC 91 ms
6,580 KB
testcase_19 AC 120 ms
8,644 KB
testcase_20 AC 296 ms
13,204 KB
testcase_21 AC 253 ms
11,784 KB
testcase_22 AC 344 ms
17,316 KB
testcase_23 AC 283 ms
15,008 KB
testcase_24 AC 243 ms
10,384 KB
testcase_25 AC 181 ms
9,236 KB
testcase_26 AC 79 ms
7,292 KB
testcase_27 AC 218 ms
11,696 KB
testcase_28 AC 110 ms
8,768 KB
testcase_29 AC 76 ms
7,592 KB
testcase_30 AC 79 ms
6,292 KB
testcase_31 AC 376 ms
16,592 KB
testcase_32 AC 466 ms
18,276 KB
testcase_33 AC 462 ms
17,920 KB
testcase_34 AC 466 ms
18,044 KB
testcase_35 AC 464 ms
17,640 KB
testcase_36 AC 457 ms
17,996 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 = 1 << 30;
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());
    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){
        if (seg.get(i) == inf) cout << 1;
        else cout << seg.get(i);
        if (i != n-1){
            cout << " ";
        }
    }
    cout << endl;
}
0