結果

問題 No.1675 Strange Minimum Query
ユーザー c--c--
提出日時 2021-09-13 19:52:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 378 ms / 2,000 ms
コード長 1,497 bytes
コンパイル時間 4,387 ms
コンパイル使用メモリ 268,740 KB
実行使用メモリ 11,728 KB
最終ジャッジ日時 2023-09-08 03:28:50
合計ジャッジ時間 16,993 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 232 ms
7,488 KB
testcase_04 AC 204 ms
8,144 KB
testcase_05 AC 17 ms
5,124 KB
testcase_06 AC 273 ms
8,292 KB
testcase_07 AC 289 ms
9,572 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 137 ms
8,332 KB
testcase_11 AC 36 ms
6,704 KB
testcase_12 AC 153 ms
8,628 KB
testcase_13 AC 284 ms
11,692 KB
testcase_14 AC 332 ms
11,656 KB
testcase_15 AC 296 ms
11,692 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 54 ms
4,660 KB
testcase_18 AC 80 ms
5,192 KB
testcase_19 AC 102 ms
7,808 KB
testcase_20 AC 245 ms
9,740 KB
testcase_21 AC 213 ms
9,484 KB
testcase_22 AC 280 ms
10,216 KB
testcase_23 AC 233 ms
7,332 KB
testcase_24 AC 202 ms
7,540 KB
testcase_25 AC 151 ms
6,000 KB
testcase_26 AC 71 ms
5,656 KB
testcase_27 AC 186 ms
8,860 KB
testcase_28 AC 96 ms
7,572 KB
testcase_29 AC 66 ms
7,308 KB
testcase_30 AC 68 ms
5,724 KB
testcase_31 AC 304 ms
9,056 KB
testcase_32 AC 378 ms
11,672 KB
testcase_33 AC 375 ms
11,664 KB
testcase_34 AC 377 ms
11,728 KB
testcase_35 AC 370 ms
11,644 KB
testcase_36 AC 371 ms
11,656 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