Submission #1182130

#TimeUsernameProblemLanguageResultExecution timeMemory
1182130avighnaBitaro, who Leaps through Time (JOI19_timeleap)C++20
4 / 100
3086 ms4808 KiB
#include <bits/stdc++.h> typedef long long ll; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n, q; std::cin >> n >> q; std::vector<ll> l(n - 1), r(n - 1); for (int i = 0; i < n - 1; ++i) { std::cin >> l[i] >> r[i]; } while (q--) { int t; std::cin >> t; if (t == 1) { int p, s, e; std::cin >> p >> s >> e; l[p - 1] = s, r[p - 1] = e; } else { ll a, b, c, d; std::cin >> a >> b >> c >> d; ll ans = 0; --a, --c; for (int i = a < c ? a : a - 1; (a < c and i < c) or (a > c and i >= c);) { if (b < l[i]) { b = l[i]; } else if (b > r[i] - 1) { ans += b - (r[i] - 1); b = r[i] - 1; } b++; i += a < c ? 1 : -1; } if (b > d) { ans += b - d; b = d; } std::cout << ans << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...