結果
問題 |
No.1675 Strange Minimum Query
|
ユーザー |
|
提出日時 | 2024-07-31 02:26:16 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 253 ms / 2,000 ms |
コード長 | 931 bytes |
コンパイル時間 | 3,849 ms |
コンパイル使用メモリ | 268,896 KB |
実行使用メモリ | 19,716 KB |
最終ジャッジ日時 | 2024-07-31 02:26:32 |
合計ジャッジ時間 | 14,809 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/lazysegtree> #include <atcoder/segtree> 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); } segtree<T, op, e> s(N); for(ll i = 0; i < N; i++) { s.set(i, S.get(i)); } 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]; } }