제출 #887652

#제출 시각아이디문제언어결과실행 시간메모리
887652pccSegments (IZhO18_segments)C++14
0 / 100
18 ms10324 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const int mxn = 5050; int Q,t; set<int> id; pii arr[mxn]; int preans = 0; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>Q>>t; for(int i = 1;i<=Q;i++)id.insert(i); while(Q--){ int tp; cin>>tp; if(tp == 1){ int l,r; cin>>l>>r; l = l^(t*preans); r = r^(t*preans); arr[*id.begin()] = {l,r}; id.erase(*id.begin()); } else if(tp == 2){ int tar; cin>>tar; id.insert(tar); arr[tar] = {-1,-1}; } else{ int l,r,v; cin>>l>>r>>v; l = l^(t*preans); r = r^(t*preans); if(r<l)swap(l,r); int tans = 0; for(int i = 1;i<=*id.rbegin();i++){ pii range = {max(arr[i].fs,l),min(arr[i].sc,r)}; if(range.sc-range.fs+1>=v)tans++; } cout<<(preans = tans)<<'\n'; } } 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...