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>
#ifdef local
#include "algo/debug.h"
#else
#define dbg(x...) 0
#endif
using namespace std ;
using ll = long long ;
using ld = long double ;
int32_t main() {
ios::sync_with_stdio(false) ;
cin.tie(nullptr) ;
int n , t; cin >> n >> t ;
int last = 0 ;
int idx = 0 ;
pair<int,int> pr[n + 1] ;
multiset<pair<int,int>> s ;
for (int i = 0 ; i < n ; i++) {
int cmd ; cin >> cmd ;
if (cmd == 1) {
int a , b; cin >> a >> b ;
int l = (a ^ (t * last)) ;
int r = (b ^ (t * last)) ;
if (l > r) swap(l, r) ;
s.insert({l, r}) ; idx++ ;
pr[idx]= {l, r} ;
} else if (cmd == 2) {
int ind ; cin >> ind ;
auto c = pr[ind] ;
s.erase(s.find(c)) ;
} else {
int a, b, k ; cin >> a >> b >> k ;
int l = (a ^ (last * t)) ;
int r = (b ^ (last * t)) ;
if (l > r) swap(l, r) ;
int ret = 0 ;
for (auto [_l, _r] : s) {
int L = max(_l, l) ;
int R = min(_r, r) ;
if (R - L + 1 >= k) {
ret++ ;
}
}
cout << ret << "\n" ;
last = ret ;
}
}
return 0 ;
}
// 希望白银
# | 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... |