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;
#define int long long
#define pb push_back
#define sz(x) x.size()
#define F first
#define S second
#define nl '\n'
signed main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
int q, t;
cin >>q >>t;
int lans = 0, id = 0;
map<int, pair<int, int>>seg;
while( q-- )
{
int type, l, r, k, id1;
cin >>type;
if( type == 1 )
{
cin >>l >>r;
l = (l ^ (t * lans));
r = (r ^ (t * lans));
if( l > r )
swap(l, r);
++id;
seg[id] = {l, r};
}
else if( type == 2 )
{
cin >>id1;
seg[id1] = {0, 0};
}
else
{
cin >>l >>r >>k;
l = (l ^ (t * lans));
r = (r ^ (t * lans));
if( l > r )
swap(l, r);
int res = 0;
for( int i = 1; i <= id; ++i )
{
int l1 = max(l, seg[i].F);
int r1 = min(r, seg[i].S);
if( r1 - l1 + 1 >= k )
++res;
}
cout <<res <<nl;
lans = res;
}
}
}
# | 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... |