# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
495967 | Nalrimet | Segments (IZhO18_segments) | C++17 | 5091 ms | 1240 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;
const int N = 2 * 1e5 + 5;
const int inf = 1000000000;
//#define int long long
#define F first
#define S second
#define pb push_back
int n, t, a, b, lastans, k, id;
//bool used[N];
vector<pair<int, int>> v;
main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> t;
int type;
while(n--){
cin >> type;
if(type == 1){
cin >> a >> b;
a = a ^ (t * lastans);
b = b ^ (t * lastans);
if(a > b) swap(a, b);
// used[v.size()] = 1;
v.pb({a, b});
}
else if(type == 2){
cin >> id;
// used[id - 1] = 0;
}
else{
cin >> a >> b >> k;
a = a ^ (t * lastans);
b = b ^ (t * lastans);
if(a > b) swap(a, b);
lastans = 0;
for(int i = 0; i < v.size(); ++i){
// if(used[i]){
if(min(v[i].S, b) - max(v[i].F, a) + 1 >= k) lastans++;
// }
}
cout << lastans << '\n';
}
}
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... |