이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 2e5;
const ll inf = 3e18;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> void vout(T s){cout << s << endl;exit(0);}
int main(){
ios_base :: sync_with_stdio(0);
cin.tie(0);
ll n, t;
cin >> n >> t;
ll last = 0;
vector <pll> a;
multiset <pll> s;
while(n--){
ll type;
cin >> type;
if(type == 1){
ll l, r;
cin >> l >> r;
l = (l ^ (t * last));
r = (r ^ (t * last));
if(l > r)swap(l, r);
a.p_b({l, r});
s.insert({l, r});
}else if(type == 2){
ll id;
cin >> id;
s.erase(s.find(a[id - 1]));
}else{
ll l, r, k;
cin >> l >> r >> k;
l = (l ^ (t * last));
r = (r ^ (t * last));
if(l > r)swap(l, r);
ll ans = 0;
for(auto i : s){
ll le = max(i.fi, l), ri = min(i.se, r);
if(ri - le + 1 >= k)ans++;
}
cout << ans << "\n";
last = ans;
}
}
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... |