# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1016534 | Vanio | Segments (IZhO18_segments) | C++17 | 5068 ms | 6876 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |