結果

問題 No.1675 Strange Minimum Query
ユーザー umncumnc
提出日時 2021-09-13 20:22:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 381 ms / 2,000 ms
コード長 1,497 bytes
コンパイル時間 5,564 ms
コンパイル使用メモリ 268,712 KB
実行使用メモリ 11,724 KB
最終ジャッジ日時 2023-09-08 04:03:24
合計ジャッジ時間 17,244 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 232 ms
7,456 KB
testcase_04 AC 204 ms
8,128 KB
testcase_05 AC 17 ms
5,192 KB
testcase_06 AC 274 ms
8,236 KB
testcase_07 AC 290 ms
9,640 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 138 ms
8,344 KB
testcase_11 AC 36 ms
6,724 KB
testcase_12 AC 152 ms
8,604 KB
testcase_13 AC 285 ms
11,684 KB
testcase_14 AC 328 ms
11,720 KB
testcase_15 AC 297 ms
11,556 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 55 ms
4,756 KB
testcase_18 AC 79 ms
4,900 KB
testcase_19 AC 103 ms
7,808 KB
testcase_20 AC 245 ms
9,584 KB
testcase_21 AC 215 ms
9,108 KB
testcase_22 AC 282 ms
10,088 KB
testcase_23 AC 234 ms
7,200 KB
testcase_24 AC 203 ms
7,448 KB
testcase_25 AC 152 ms
6,240 KB
testcase_26 AC 71 ms
5,668 KB
testcase_27 AC 188 ms
8,880 KB
testcase_28 AC 97 ms
7,512 KB
testcase_29 AC 66 ms
7,324 KB
testcase_30 AC 69 ms
5,716 KB
testcase_31 AC 304 ms
9,060 KB
testcase_32 AC 381 ms
11,724 KB
testcase_33 AC 376 ms
11,620 KB
testcase_34 AC 379 ms
11,704 KB
testcase_35 AC 373 ms
11,568 KB
testcase_36 AC 372 ms
11,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define reps(i, s, e) for (ll i = s; i <= e; ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using ld = long double;
using cp = complex<ld>;
using pa = pair<ll, ll>;
using tup = tuple<ll, ll, ll>;
using vp = vector<pair<ll, ll>>;
using vtup = vector<tuple<ll, ll, ll>>;
using st = string;
using vs = vector<string>;
using vc = vector<char>;
using vvi = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vi = vector<ll>;
const ll MOD1 = 1000000007;
const ll MOD2 = 998244353;
const ll INF = (1LL << 60);

using S = int;
using F = int;
S op(S a, S b) { return min(a, b); }
S e() { return int(1e9); }
S mapping(F x, S a) { return x == -1 ? a : x; }
F composition(F f, F g) { return f == -1 ? g : f; }
F id() { return -1; }

int main() {
  ll n, q;
  cin >> n >> q;
  vector<array<ll, 3>> query(q);
  rep(i, q) {
    ll l, r, b;
    cin >> l >> r >> b;
    l--;
    query[i] = {b, l, r};
  }
  sort(all(query));
  lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);

  for (auto [b, l, r] : query) {
    seg.apply(l, r, b);
  }

  for (auto [b, l, r] : query) {
    if (seg.prod(l, r) != b) {
      cout << -1 << endl;
      return 0;
    }
  }

  rep(i, n) {
    cout << seg.get(i);
    if (i != n - 1) {
      cout << " ";
    } else {
      cout << endl;
    }
  }

  return 0;
}
0