Submission #939435

#TimeUsernameProblemLanguageResultExecution timeMemory
939435AkibAzmainSegments (IZhO18_segments)C++17
7 / 100
5061 ms7740 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using ll = long long; using namespace __gnu_pbds; template < class key, class compare = less < key > > using iset = tree < key, null_type, compare, rb_tree_tag, tree_order_statistics_node_update >; void solve (int tc, int ttc) { ll q, t; cin >> q >> t; map < ll, pair < ll, ll > > a; ll i = 1; ll las = 0; while (q--) { int o; cin >> o; if (o == 1) { ll x, y; cin >> x >> y; x ^= t * las; y ^= t * las; if (x > y) swap (x, y); a[i++] = { x, y }; } else if (o == 2) { int id; cin >> id; a.erase (id); } else { ll x, y, k; cin >> x >> y >> k; x ^= t * las; y ^= t * las; if (x > y) swap (x, y); ll ans = 0; for (auto &s : a) if (min (s.second.second, y) - max (s.second.first, x) + 1 >= k) ++ans; cout << ans << '\n'; las = ans; } } } int main () { ios::sync_with_stdio (false); cin.tie (nullptr); int ttc = 1; // cin >> ttc; for (int tc = 1; tc <= ttc; ++tc) solve (tc, ttc); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...