# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110299 | KasymK | Segments (IZhO18_segments) | C++17 | 5048 ms | 7616 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;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int f(int a, int b, int c, int d){
if(a>c)
swap(a,c), swap(b,d);
if(b<c)
return 0;
if(b<=d)
return b-c+1;
return d-c+1;
}
const int N = 2e5+5;
bool is[N];
int main(){
// freopen("file.txt", "r", stdin);
int q, t, answer = 0;
scanf("%d%d", &q, &t);
vector<pii> S;
while(q--){
int op;
scanf("%d", &op);
if(op==1){
int a, b;
scanf("%d%d", &a, &b);
int l = a^(t*answer), r = b^(t*answer);
if(l>r)
swap(l, r);
S.pb({l, r});
}
else if(op==2){
int need;
scanf("%d", &need);
is[--need] = 1;
}
else{
int a, b, k;
scanf("%d%d%d", &a, &b, &k);
int l = a^(t*answer), r = b^(t*answer);
if(l>r)
swap(l, r);
answer = 0;
for(int i = 0; i < (int)S.size(); ++i){
if(is[i])
continue;
answer += (min(r, S[i].ss)-max(l, S[i].ff)) >= k-1;
}
printf("%d\n", answer);
}
}
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... |