結果
| 問題 | 
                            No.1675 Strange Minimum Query
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-09-10 22:00:06 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,144 bytes | 
| コンパイル時間 | 1,073 ms | 
| コンパイル使用メモリ | 87,180 KB | 
| 実行使用メモリ | 9,600 KB | 
| 最終ジャッジ日時 | 2024-06-12 00:02:20 | 
| 合計ジャッジ時間 | 9,863 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 5 WA * 29 | 
ソースコード
#include <atcoder/lazysegtree>
#include <algorithm>
#include <iostream>
using namespace std;
using namespace atcoder;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int INF = 1000000000;
struct S
{
    int x;
};
S op(S a, S b){
    return S{min(a.x, b.x)};
}
S e(){
    return S{INF};
}
struct F
{
    int f;
};
S mapping(F f, S a){
    if(f.f == 0) return a;
    return S{f.f};
}
F composition(F f, F g){
    if(f.f == 0) return g;
    return f;
}
F id(){
    return F{0};
}
int main()
{
    int n, q;
    cin >> n >> q;
    PP p[200005];
    for(int i = 0; i < q; i++){
        int l, r, b;
        cin >> l >> r >> b;
        l--;
        p[i] = PP(b, P(l, r));
    }
    sort(p, p + q);
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(n);
    for(int i = 0; i < q; i++){
        seg.apply(p[i].second.first, p[i].second.second, F{p[i].first});
    }
    for(int i = 0; i < q; i++){
        if(seg.prod(p[i].second.first, p[i].second.second).x != p[i].first){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i = 0; i < n; i++) cout << seg.get(i).x << " ";
    cout << endl;
}