제출 #1128675

#제출 시각아이디문제언어결과실행 시간메모리
1128675_callmelucianSegments (IZhO18_segments)C++17
0 / 100
5082 ms1424 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pl; typedef pair<int,int> pii; typedef tuple<int,int,int> tpl; #define all(a) a.begin(), a.end() #define filter(a) a.erase(unique(all(a)), a.end()) int intr (pii a, pii b) { return min(a.second, b.second) - max(a.first, b.first) + 1; } int main() { ios::sync_with_stdio(0); cin.tie(0); int n, t, ans = 0; cin >> n >> t; vector<bool> used(n); vector<pii> seg(n); for (int i = 0; i < n; i++) { int type; cin >> type; if (type == 1) { int a, b, id = 0; cin >> a >> b; int l = (a ^ (t * ans)), r = (b ^ (t * ans)); if (l > r) swap(l, r); for (; used[id]; id++); used[id] = 1, seg[id] = {l, r}; } else if (type == 2) { int id; cin >> id; used[id - 1] = 0; } else { int a, b, k; cin >> a >> b >> k; int l = (a ^ (t * ans)), r = (b ^ (t * ans)); if (l > r) swap(l, r); ans = 0; // for (int j = 0; j < n; j++) // if (used[j]) cout << "(" << seg[j].first << " " << seg[j].second << ") "; // cout << "\n"; for (int j = 0; j < n; j++) if (used[j] && intr(seg[j], make_pair(l, r)) >= k) ans++; cout << ans << "\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...