제출 #960879

#제출 시각아이디문제언어결과실행 시간메모리
960879pragmatistSegments (IZhO18_segments)C++17
0 / 100
5012 ms3204 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5+7; int n, t; pair<int, int> a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> t; int ans = 0, timer = 0; multiset<pair<int, int> > s; for(int i = 1; i <= n; ++i) { char tp; cin >> tp; if(tp == '1') { int l, r; cin >> l >> r; l = (l^(t*ans)); r = (r^(t*ans)); if(l>r) { swap(l, r); } a[++timer] = {l, r}; s.insert({l, r}); } else if(tp == '2') { int id; cin >> id; auto it = s.find(a[id]); s.erase(it); } else { int l, r, k; cin >> l >> r >> k; l = (l^(t*ans)); r = (r^(t*ans)); if(l>r) { swap(l, r); } if(r-l+1<k) { cout << (ans=0) << "\n"; continue; } int res = 0; for(auto [x, y] : s) { if(y-x+1<k) { res++; continue; } if(y<l+k-1) { res++; } if(x > r-k+1) { res++; } } for(auto [x, y] : s) { if(y<l+k-1) { res++; } if(x > l && x<=r-k+1) { res += (y-x+1<k); } if(x > r-k+1) { res++; } } cout << (int)s.size()-res << "\n"; ans = (int)s.size()-res; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...