Submission #1234078

#TimeUsernameProblemLanguageResultExecution timeMemory
1234078antonnBitaro, who Leaps through Time (JOI19_timeleap)C++20
0 / 100
3095 ms3276 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 7; int n, q, l[N], r[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> q; for (int i = 1; i < n; ++i) cin >> l[i] >> r[i]; while (q--) { int t; cin >> t; if (t == 1) { int p, s, e; cin >> p >> s >> e; l[p] = s; r[p] = e; } else { int a, b, c, d; cin >> a >> b >> c >> d; int t = b; ll ans = 0; for (int i = a; i < c; ++i) { if (t >= r[i]) { ans += t - (r[i] - 1); t = r[i] - 1; } else { t = max(t, l[i]); } ++t; } ans += max(0, t - d); cout << ans << "\n"; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...