結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 622 ms
32,588 KB
testcase_04 AC 500 ms
29,888 KB
testcase_05 AC 28 ms
6,112 KB
testcase_06 AC 759 ms
37,824 KB
testcase_07 AC 784 ms
38,200 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 #

//#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--)

int op(int a, int b) {return min(a, b);}
int e() {return (int)(1e9);}

int main(){
    int n,q; cin >> n >> q;
    deque<vi> event;
    vvi J;
    rep(_,0,q){
        int l,r,b; cin >> l >> r >> b; --l;
        event.push_back({l,1,-b});
        event.push_back({r,-1,-b});
        J.push_back({l,r,b});
    }
    sort(event.begin(),event.end());
    set<int> S;
    segtree<int,op,e> seg(n);
    rep(d,0,n){
        while (!event.empty() && event[0][0] <= d){
            if (event[0][1] == 1) S.insert(event[0][2]);
            else S.erase(event[0][2]);
            event.pop_front();
        }
        if (!S.empty()) seg.set(d,-*S.begin());
        else seg.set(d,1);
    }
    rep(i,0,q){
        int l = J[i][0], r = J[i][1], b = J[i][2];
        if (seg.prod(l,r) != b){
            cout << -1 << endl;
            return 0;
        }
    }
    rep(i,0,n){
        cout << seg.get(i) << " ";
    }
    cout << endl;
}
0