結果

問題 No.1675 Strange Minimum Query
ユーザー norikamenorikame
提出日時 2021-09-10 22:28:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 1,409 bytes
コンパイル時間 5,136 ms
コンパイル使用メモリ 263,524 KB
実行使用メモリ 12,428 KB
最終ジャッジ日時 2023-09-02 18:47:21
合計ジャッジ時間 17,081 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 255 ms
5,988 KB
testcase_04 AC 237 ms
8,136 KB
testcase_05 AC 30 ms
6,704 KB
testcase_06 AC 297 ms
6,176 KB
testcase_07 AC 329 ms
8,612 KB
testcase_08 AC 2 ms
4,368 KB
testcase_09 AC 2 ms
4,368 KB
testcase_10 AC 137 ms
10,512 KB
testcase_11 AC 38 ms
9,752 KB
testcase_12 AC 149 ms
10,848 KB
testcase_13 AC 269 ms
12,288 KB
testcase_14 AC 325 ms
12,228 KB
testcase_15 AC 297 ms
12,264 KB
testcase_16 AC 1 ms
4,368 KB
testcase_17 AC 52 ms
5,060 KB
testcase_18 AC 75 ms
5,436 KB
testcase_19 AC 103 ms
10,504 KB
testcase_20 AC 237 ms
11,136 KB
testcase_21 AC 210 ms
11,080 KB
testcase_22 AC 277 ms
11,800 KB
testcase_23 AC 217 ms
6,416 KB
testcase_24 AC 192 ms
7,764 KB
testcase_25 AC 142 ms
5,808 KB
testcase_26 AC 70 ms
7,104 KB
testcase_27 AC 185 ms
10,896 KB
testcase_28 AC 98 ms
10,108 KB
testcase_29 AC 70 ms
10,148 KB
testcase_30 AC 67 ms
6,844 KB
testcase_31 AC 288 ms
8,636 KB
testcase_32 AC 372 ms
12,264 KB
testcase_33 AC 369 ms
12,304 KB
testcase_34 AC 371 ms
12,428 KB
testcase_35 AC 358 ms
12,256 KB
testcase_36 AC 361 ms
12,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

using ll = long long;

#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))
#define all(x) (x).begin(), (x).end()

const int INF = (int)(2e9);

int op(int l, int r) { return max(l, r); }
int e() { return 1; }
int mapping(int f, int r) { return max(f, r); }
int composition(int f, int g) { return max(f, g); }
int id() { return 1; }

int op2(int l, int r) { return min(l, r); }
int e2() { return INF; }
int mapping2(int f, int r) { return min(f, r); }
int composition2(int f, int g) { return min(f, g); }
int id2() { return INF; }

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> l(q), r(q), b(q);
    rep(i, q) {
        cin >> l[i] >> r[i] >> b[i];
        l[i]--;
    }
    lazy_segtree<int, op, e, int, mapping, composition, id> lseg1(n+1);
    rep(i, q) lseg1.apply(l[i], r[i], b[i]);
    vector<int> res(n);
    rep(i, n) res[i] = lseg1.get(i);
    lazy_segtree<int, op2, e2, int, mapping2, composition2, id2> lseg2(res);
    bool ok = true;
    rep(i, q) if (lseg2.prod(l[i], r[i]) != b[i]) ok = false;
    if (ok) rep(i, n) printf("%d%c", res[i], (i<n-1?' ':'\n'));
    else cout << -1 << endl;
    return 0;
}
0