Submit Info #12307

Problem Lang User Status Time Memory
Range Chmin Chmax Add Range Sum cpp mrdomino AC 8908 ms 3.05 MiB

ケース詳細
Name Status Time Memory
example_00 AC 3 ms 0.67 MiB
max_random_00 AC 8880 ms 3.05 MiB
max_random_01 AC 8908 ms 3.05 MiB
max_random_02 AC 8900 ms 3.05 MiB
medium_00 AC 3 ms 0.67 MiB
medium_01 AC 2 ms 0.71 MiB
medium_02 AC 3 ms 0.68 MiB
random_00 AC 4223 ms 2.32 MiB
random_01 AC 4935 ms 2.42 MiB
random_02 AC 1425 ms 1.55 MiB
small_00 AC 1 ms 0.67 MiB
small_01 AC 1 ms 0.67 MiB
small_02 AC 1 ms 0.70 MiB
small_03 AC 4 ms 0.72 MiB
small_04 AC 2 ms 0.68 MiB
small_05 AC 0 ms 0.68 MiB
small_06 AC 1 ms 0.67 MiB
small_07 AC 3 ms 0.67 MiB
small_08 AC 0 ms 0.68 MiB
small_09 AC 3 ms 0.68 MiB

#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; const int N = 200000 + 7; int n, q; ll a[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> q; for (int i = 1; i <= n; i++) { cin >> a[i]; } while (q--) { int t, l, r; cin >> t >> l >> r; l++; if (t == 0) { ll x; cin >> x; for (int i = l; i <= r; i++) { a[i] = min(a[i], x); } } if (t == 1) { ll x; cin >> x; for (int i = l; i <= r; i++) { a[i] = max(a[i], x); } } if (t == 2) { ll x; cin >> x; for (int i = l; i <= r; i++) { a[i] += x; } } if (t == 3) { ll sol = 0; for (int i = l; i <= r; i++) { sol += a[i]; } cout << sol << "\n"; } } return 0; }