제출 #1130371

#제출 시각아이디문제언어결과실행 시간메모리
1130371TsaganaSegments (IZhO18_segments)C++17
75 / 100
5092 ms2888 KiB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

void solve () {
	int n, t, ans = 0; cin >> n >> t;
	vector<int> L, R, id;
	while (n--) {
		int q; cin >> q;
		if (q == 1) {
			int l, r; cin >> l >> r;
			l ^= (t * ans);
			r ^= (t * ans);
			if (l > r) swap(l, r);
			L.pb(l); R.pb(r); id.pb(1);
		}
		if (q == 2) {int i; cin >> i; id[i-1] = 0;}
		if (q == 3) {
			int l, r, k; cin >> l >> r >> k;
			l ^= (t * ans);
			r ^= (t * ans);
			if (l > r) swap(l, r);
			int s = L.size(); ans = 0;
			for (int i = 0; i < s; i++) {
				if (!id[i]) continue ;
				if ((R[i]<r?R[i]:r) - (L[i]>l?L[i]:l) + 1 >= k) ans++;
			}
			cout << ans << '\n';
		}
	}
}
signed main() {IOS solve(); 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...