Submission #683742

#TimeUsernameProblemLanguageResultExecution timeMemory
683742MateGiorbelidzeSegments (IZhO18_segments)C++14
75 / 100
5050 ms8588 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define sc second #define pb push_back #define in insert void dambo_12() { int n , t, lastans = 0, m = 0; cin>>n>>t; vector <pair <int,int>> a(n + 1 , {0,0}); for (int it = 1; it <= n; it++) { int tp; cin>>tp; if (tp == 1) { int l , r; cin>>l>>r; l = l ^ (t * lastans); r = r ^ (t * lastans); if (l > r) swap(l , r); m++; a[m].ff = l; a[m].sc = r; } if (tp == 2) { int id; cin>>id; a[id].ff = 0; a[id].sc = 0; } if (tp == 3) { int l , r , k , cnt = 0; cin>>l>>r>>k; l = l ^ (t * lastans); r = r ^ (t * lastans); if (l > r) swap(l , r); for (int i = 1; i <= m; i++) { if (min(a[i].sc , r) - max(a[i].ff , l) + 1 >= k) cnt++; } lastans = cnt; cout<<cnt<<'\n'; } } return; } int32_t main () { ios::sync_with_stdio(false); cin.tie(nullptr); ll o = 1; //cin>>o; while (o--) { dambo_12(); } return 0; }
#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...