結果

問題 No.1675 Strange Minimum Query
ユーザー miscalcmiscalc
提出日時 2021-09-10 23:32:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,721 bytes
コンパイル時間 2,407 ms
コンパイル使用メモリ 214,844 KB
実行使用メモリ 15,620 KB
最終ジャッジ日時 2023-09-02 22:30:25
合計ジャッジ時間 13,306 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 228 ms
7,968 KB
testcase_04 AC 203 ms
10,220 KB
testcase_05 AC 18 ms
7,252 KB
testcase_06 AC 268 ms
8,920 KB
testcase_07 AC 287 ms
11,536 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 272 ms
15,620 KB
testcase_14 AC 317 ms
15,620 KB
testcase_15 AC 290 ms
15,276 KB
testcase_16 AC 2 ms
4,372 KB
testcase_17 AC 53 ms
5,792 KB
testcase_18 AC 78 ms
5,944 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 273 ms
14,108 KB
testcase_23 AC 226 ms
8,376 KB
testcase_24 AC 195 ms
9,620 KB
testcase_25 AC 147 ms
6,948 KB
testcase_26 WA -
testcase_27 AC 179 ms
12,732 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 296 ms
11,012 KB
testcase_32 AC 367 ms
15,504 KB
testcase_33 AC 363 ms
15,416 KB
testcase_34 AC 365 ms
15,220 KB
testcase_35 AC 355 ms
15,456 KB
testcase_36 AC 354 ms
15,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
//using mint = modint1000000007;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using tlll = tuple<ll, ll, ll>;
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll safemod(ll A, ll M) {return (A % M + M) % M;}
ll divfloor(ll A, ll B) {if (B < 0) {return divfloor(-A, -B);} return (A - safemod(A, B)) / B;}
ll divceil(ll A, ll B) {if (B < 0) {return divceil(-A, -B);} return divfloor(A + B - 1, B);}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

#include <atcoder/lazysegtree>

ll op(ll a, ll b)
{
  return min(a, b);
}

ll e()
{
  return INF;
}

ll mapping(ll f, ll x)
{
  return (f == INF ? x : f);
}

ll composition(ll f, ll g)
{
  return (f == INF ? g : f);
}

ll id()
{
  return INF;
}

int main()
{
  ll N, Q;
  cin >> N >> Q;
  vector<tlll> BLR(Q);
  for (ll q = 0; q < Q; q++)
  {
    ll l, r, b;
    cin >> l >> r >> b;
    l--;
    BLR.at(q) = make_tuple(b, l, r);
  }

  sort(BLR.begin(), BLR.end());

  lazy_segtree<ll, op, e, ll, mapping, composition, id> seg(N);
  for (ll q = 0; q < Q; q++)
  {
    auto blr = BLR.at(q);
    ll b = get<0>(blr), l = get<1>(blr), r = get<2>(blr);

    seg.apply(l, r, b);
  }

  for (ll q = 0; q < Q; q++)
  {
    auto blr = BLR.at(q);
    ll b = get<0>(blr), l = get<1>(blr), r = get<2>(blr);

    if (seg.prod(l, r) != b)
      FINALANS(-1);
  }

  for (ll i = 0; i < N; i++)
  {
    cout << seg.get(i) << (i == N - 1 ? '\n' : ' ');
  }
}
0