結果

問題 No.1675 Strange Minimum Query
ユーザー みここみここ
提出日時 2021-09-10 22:00:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,144 bytes
コンパイル時間 1,079 ms
コンパイル使用メモリ 82,752 KB
実行使用メモリ 9,644 KB
最終ジャッジ日時 2023-09-02 17:32:55
合計ジャッジ時間 11,051 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
5,696 KB
testcase_02 WA -
testcase_03 AC 218 ms
5,908 KB
testcase_04 AC 190 ms
7,368 KB
testcase_05 AC 18 ms
7,380 KB
testcase_06 AC 256 ms
6,092 KB
testcase_07 AC 273 ms
7,220 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/lazysegtree>
#include <algorithm>
#include <iostream>
using namespace std;
using namespace atcoder;
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int INF = 1000000000;

struct S
{
    int x;
};

S op(S a, S b){
    return S{min(a.x, b.x)};
}

S e(){
    return S{INF};
}

struct F
{
    int f;
};

S mapping(F f, S a){
    if(f.f == 0) return a;
    return S{f.f};
}

F composition(F f, F g){
    if(f.f == 0) return g;
    return f;
}

F id(){
    return F{0};
}

int main()
{
    int n, q;
    cin >> n >> q;
    PP p[200005];
    for(int i = 0; i < q; i++){
        int l, r, b;
        cin >> l >> r >> b;
        l--;
        p[i] = PP(b, P(l, r));
    }
    sort(p, p + q);
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);
    for(int i = 0; i < q; i++){
        seg.apply(p[i].second.first, p[i].second.second, F{p[i].first});
    }
    for(int i = 0; i < q; i++){
        if(seg.prod(p[i].second.first, p[i].second.second).x != p[i].first){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i = 0; i < n; i++) cout << seg.get(i).x << " ";
    cout << endl;
}
0