結果
問題 | No.1675 Strange Minimum Query |
ユーザー |
|
提出日時 | 2024-07-31 02:27:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 303 ms / 2,000 ms |
コード長 | 825 bytes |
コンパイル時間 | 4,344 ms |
コンパイル使用メモリ | 268,872 KB |
実行使用メモリ | 15,636 KB |
最終ジャッジ日時 | 2024-07-31 02:27:46 |
合計ジャッジ時間 | 13,510 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/lazysegtree>using namespace std;using namespace atcoder;using ll = long long;using T = ll;using F = ll;T op(T l, T r) { return min(l, r); }T e() { return 1e18; }T fx(F f, T x) { return (f == 1e18 ? x : f); }F fg(F f, F g) { return (f == 1e18 ? g : f); }F id() { return 1e18; }int main() {ios::sync_with_stdio(false);cin.tie(nullptr);ll N, K;cin >> N >> K;vector<tuple<ll, ll, ll>> v(K);for(auto &[x, l, r] : v) { cin >> l >> r >> x; }ranges::sort(v);lazy_segtree<T, op, e, F, fx, fg, id> S(vector<T>(N, 1));for(auto &[x, l, r] : v) { S.apply(--l, r, x); }for(auto &[x, l, r] : v) {if(S.prod(l, r) != x) {cout << -1 << "\n";return 0;}}for(ll i = 0; i < N; i++) { cout << S.get(i) << " \n"[i == N - 1]; }}