Submission #1016534

#TimeUsernameProblemLanguageResultExecution timeMemory
1016534VanioSegments (IZhO18_segments)C++17
7 / 100
5068 ms6876 KiB
#include<bits/stdc++.h> using namespace std; struct segment{ int l,r; }; segment segments[200001]; int n,t,nextSegmentId,lastans; set<int> segmentIds; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int i,qt,l,r,id,k,ans; cin>>n>>t; while(n--){ cin>>qt; if(qt==1){ cin>>l>>r; l^=t*lastans; r^=t*lastans; if(l>r) swap(l,r); nextSegmentId++; segments[nextSegmentId].l=l; segments[nextSegmentId].r=r; segmentIds.insert(nextSegmentId); } else if(qt==2){ cin>>id; segmentIds.erase(id); } else{ cin>>l>>r>>k; l^=t*lastans; r^=t*lastans; if(l>r) swap(l,r); ans=0; for(auto it : segmentIds){ if(min(r,segments[it].r)-max(l,segments[it].l)+1>=k) ans++; } cout<<ans<<'\n'; lastans=ans; } } return 0; }

Compilation message (stderr)

segments.cpp: In function 'int main()':
segments.cpp:18:5: warning: unused variable 'i' [-Wunused-variable]
   18 | int i,qt,l,r,id,k,ans;
      |     ^
#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...