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;
int x, q, a, b, l, r, lst, k, t;
vector<pair<int, int>> v;
bool d[5005];
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>q>>x;
while (q--)
{
cin>>t;
if (t==1)
{
cin>>a>>b;
l=a^(lst*x);
r=b^(lst*x);
v.push_back({l, r});
}
if (t==2)
{
cin>>a;
a--;
d[a]=1;
}
if (t==3)
{
cin>>a>>b>>k;
int res=0;
l=a^(lst*x);
r=b^(lst*x);
if (l>r) swap(l, r);
for (int i=0; i<v.size(); i++)
{
if (d[i]) continue;
if (min(v[i].second, r)-max(v[i].first, l)+1>=k) res++;
}
lst=res;
cout<<res<<'\n';
}
}
}
Compilation message (stderr)
segments.cpp: In function 'int main()':
segments.cpp:36:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | for (int i=0; i<v.size(); i++)
| ~^~~~~~~~~
# | 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... |