結果

問題 No.1675 Strange Minimum Query
ユーザー otoshigootoshigo
提出日時 2021-09-17 17:22:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,679 bytes
コンパイル時間 4,808 ms
コンパイル使用メモリ 268,032 KB
実行使用メモリ 18,304 KB
最終ジャッジ日時 2023-09-12 04:25:32
合計ジャッジ時間 17,749 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 158 ms
11,312 KB
testcase_11 AC 35 ms
6,864 KB
testcase_12 AC 173 ms
12,464 KB
testcase_13 AC 301 ms
17,632 KB
testcase_14 AC 348 ms
18,304 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 59 ms
5,496 KB
testcase_18 AC 91 ms
6,532 KB
testcase_19 AC 112 ms
8,584 KB
testcase_20 AC 294 ms
13,148 KB
testcase_21 AC 245 ms
12,068 KB
testcase_22 AC 336 ms
17,144 KB
testcase_23 AC 284 ms
15,240 KB
testcase_24 AC 241 ms
10,680 KB
testcase_25 AC 178 ms
9,580 KB
testcase_26 AC 79 ms
7,360 KB
testcase_27 AC 213 ms
11,448 KB
testcase_28 AC 105 ms
8,744 KB
testcase_29 AC 68 ms
7,588 KB
testcase_30 AC 74 ms
6,392 KB
testcase_31 AC 378 ms
16,532 KB
testcase_32 AC 473 ms
18,124 KB
testcase_33 AC 457 ms
18,268 KB
testcase_34 AC 461 ms
18,024 KB
testcase_35 AC 462 ms
17,640 KB
testcase_36 AC 455 ms
18,048 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 << l << " " << r << " " << b << endl;
            cout << -1 << endl;
            return 0;
        }
    }
    rep(i,0,n){
        cout << seg.get(i);
        if (i != n-1){
            cout << " ";
        }
    }
    cout << endl;
}
0