結果

問題 No.1234 典型RMQ
ユーザー chocono2230chocono2230
提出日時 2020-09-18 23:53:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 1,053 bytes
コンパイル時間 4,217 ms
コンパイル使用メモリ 256,288 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-04-26 11:18:45
合計ジャッジ時間 10,829 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 241 ms
6,784 KB
testcase_07 AC 213 ms
5,376 KB
testcase_08 AC 243 ms
7,168 KB
testcase_09 AC 218 ms
5,376 KB
testcase_10 AC 247 ms
6,912 KB
testcase_11 AC 230 ms
6,784 KB
testcase_12 AC 226 ms
5,376 KB
testcase_13 AC 198 ms
5,376 KB
testcase_14 AC 223 ms
5,376 KB
testcase_15 AC 227 ms
5,376 KB
testcase_16 AC 267 ms
6,944 KB
testcase_17 AC 235 ms
5,376 KB
testcase_18 AC 202 ms
5,376 KB
testcase_19 AC 276 ms
7,040 KB
testcase_20 AC 193 ms
7,168 KB
testcase_21 AC 234 ms
6,784 KB
testcase_22 AC 206 ms
7,296 KB
testcase_23 AC 216 ms
7,040 KB
testcase_24 AC 211 ms
7,168 KB
testcase_25 AC 216 ms
7,040 KB
testcase_26 AC 217 ms
7,040 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;
#include <atcoder/all>
using namespace atcoder;

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

ll mapping(ll f, ll x){
  return f+x;
}

ll composition(ll f, ll g){
  return f+g;
}

ll e(){
  return (ll)1e18;
}

ll id(){
  return (ll) 0;
}

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a.at(i);
  lazy_segtree<ll, op, e, ll, mapping, composition, id> lsg(a);
  int q;
  cin >> q;
rep(_q, q){
  ll k, l, r, c;
  cin >> k >> l >> r >> c;
  if(k == 1){
    lsg.apply(l-1, r, c);
  }else{
    cout << lsg.prod(l-1, r) << endl;
  }
}

  return 0;
}
0