제출 #893653

#제출 시각아이디문제언어결과실행 시간메모리
893653vjudge1Segments (IZhO18_segments)C++17
7 / 100
5057 ms5084 KiB
// 以上帝的名义 // 候选硕士 #include <bits/stdc++.h> #ifdef local #include "algo/debug.h" #else #define dbg(x...) 0 #endif using namespace std ; using ll = long long ; using ld = long double ; int32_t main() { ios::sync_with_stdio(false) ; cin.tie(nullptr) ; int n , t; cin >> n >> t ; int last = 0 ; int idx = 0 ; pair<int,int> pr[n + 1] ; multiset<pair<int,int>> s ; for (int i = 0 ; i < n ; i++) { int cmd ; cin >> cmd ; if (cmd == 1) { int a , b; cin >> a >> b ; int l = (a ^ (t * last)) ; int r = (b ^ (t * last)) ; if (l > r) swap(l, r) ; s.insert({l, r}) ; idx++ ; pr[idx]= {l, r} ; } else if (cmd == 2) { int ind ; cin >> ind ; auto c = pr[ind] ; s.erase(s.find(c)) ; } else { int a, b, k ; cin >> a >> b >> k ; int l = (a ^ (last * t)) ; int r = (b ^ (last * t)) ; if (l > r) swap(l, r) ; int ret = 0 ; for (auto [_l, _r] : s) { int L = max(_l, l) ; int R = min(_r, r) ; if (R - L + 1 >= k) { ret++ ; } } cout << ret << "\n" ; last = ret ; } } 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...