結果

問題 No.1675 Strange Minimum Query
ユーザー yunix91201367yunix91201367
提出日時 2021-09-10 22:40:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,830 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 183,380 KB
実行使用メモリ 21,824 KB
最終ジャッジ日時 2023-09-02 19:32:00
合計ジャッジ時間 11,190 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 73 ms
11,948 KB
testcase_04 AC 63 ms
13,272 KB
testcase_05 AC 8 ms
7,416 KB
testcase_06 AC 86 ms
13,248 KB
testcase_07 AC 90 ms
16,084 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 173 ms
21,648 KB
testcase_14 AC 212 ms
21,584 KB
testcase_15 AC 200 ms
21,528 KB
testcase_16 AC 2 ms
4,368 KB
testcase_17 AC 41 ms
6,868 KB
testcase_18 AC 58 ms
7,660 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 215 ms
19,008 KB
testcase_23 AC 162 ms
11,948 KB
testcase_24 AC 150 ms
13,004 KB
testcase_25 AC 106 ms
9,616 KB
testcase_26 WA -
testcase_27 AC 144 ms
16,448 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 214 ms
15,684 KB
testcase_32 AC 284 ms
21,608 KB
testcase_33 AC 283 ms
21,580 KB
testcase_34 AC 281 ms
21,544 KB
testcase_35 AC 262 ms
21,624 KB
testcase_36 AC 260 ms
21,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
#define int long long
using namespace std;
using namespace atcoder;
using vec_int = vector<int>;
using vec_ii = vector<vec_int>;
using vec_iii = vector<vec_ii>;
using vec_iiii = vector<vec_iii>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

void cout_line(vector<int> &a){
    for(int i=0;i<a.size();i++){
        if(i<a.size()-1){
            cout<<a.at(i)<<" ";
        }else{
            cout<<a.at(i)<<endl;
        }
    }
}

int op(int a, int b){
    return min(a, b);
}
int e() {
    return INT_MAX;
}
int mapping(int f, int x){
    return max(f, x);
}
int composition(int a, int b){
    return max(a, b);
}

int id(){
    return -1;
}




signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int N, Q; cin>>N>>Q;
    vec_int l(Q), r(Q), B(Q);
    rep(i, Q)cin>>l.at(i)>>r.at(i)>>B.at(i);
    vector<T> Qs(Q);
    rep(i, Q){
        Qs.at(i) = make_tuple(B.at(i), l.at(i), r.at(i));
    }
    sort(Qs.begin(), Qs.end());
    reverse(Qs.begin(), Qs.end());

    vec_int a(N, -1);
    lazy_segtree<int, op, e, int, mapping, composition, id> seg(a);

    rep(i, Q){
        int b, L, R; tie(b, L, R) = Qs.at(i);
        L--; R--;
        int temp = seg.prod(L, R+1);
        /*
        cout<<i<<" "<<L<<" "<<R<<" "<<temp<<endl;
        for(int j=0;j<5;j++){
            cout<<"i="<<i<<" j="<<j<<" "<<seg.get(j)<<endl;
        }
        */
        if(temp!=-1&&temp>b){
            cout<<-1<<endl;
            return 0;
        }
        seg.apply(L, R+1, b);
    }
    vec_int ans(N);
    rep(i,N){
        int num = seg.get(i);
        if(num==INT_MAX)num=4545;
        ans.at(i) = num;
    }
    cout_line(ans);






    return 0;
}
0