結果

問題 No.8132 Max Cover
コンテスト
ユーザー こめだわら
提出日時 2026-04-02 21:55:57
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 2,218 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,805 ms
コンパイル使用メモリ 377,024 KB
実行使用メモリ 384,176 KB
最終ジャッジ日時 2026-04-02 21:56:11
合計ジャッジ時間 9,916 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define rep(i,n) for(ll i=0;i<n;++i)
#define all(a) (a).begin(),(a).end()
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
template<class T> T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); }
template<class T> T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); }
template <typename T, typename U> inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template <typename T, typename U> inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; }

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a){
    if (a.empty()) return os;
    os << a.front();
    for (auto e : a | views::drop(1)){
        os << ' ' << e;
    }
    return os;
}

void dump(auto ...vs){
    ((cout << vs << ' '), ...) << endl;
}

#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;

// range add range min
namespace range_add_range_min{
    using typeS = long long;
    using typeF = long long;

    const typeS INF = 8e18;

    typeS op(typeS a, typeS b){ return std::min(a, b); }
    typeS e(){ return INF; }
    typeS mapping(typeF f, typeS x){ return f+x; }
    typeF composition(typeF f, typeF g){ return f+g; }
    typeF id(){ return 0; }

    using lst_range_add_range_min=lazy_segtree<typeS,op,e,typeF,mapping,composition,id>;
}
using namespace range_add_range_min;


void solve() {
    ll Q,L;
    cin>>Q>>L;
    auto op=[](ll x,ll y)->ll {
        return min(x,y);
    };
    auto e=[]()->ll {
        return 1e18;
    };
    lst_range_add_range_min lst(vector<ll> (L,0));
    rep(_,Q){
        ll t,l,r,c;
        cin>>t>>l>>r>>c;
        if (t==1){
            lst.apply(l,r,c);
        }
        else{
            lst.apply(l,r,-c);
        }
        ll ans=lst.all_prod();
        cout<<ans<<'\n';
    }
    return;
}


int main() {
    cin.tie(0)->sync_with_stdio(0);
    ll T=1;
    while (T--){
        solve();
    }
    return 0;
}
0