# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
893649 | vjudge1 | Segments (IZhO18_segments) | C++17 | 5075 ms | 11952 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 以上帝的名义
// 候选硕士
#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() {
int n, t ;
scanf("%d%d", &n, &t) ;
int last = 0 ;
map<pair<int,int>,int> cnt ;
map<int,pair<int,int>> ind ;
int idx = 0 ;
for (int i = 0 ; i < n ; i++ ){
int type ; scanf("%d", &type) ;
if (type == 1) {
int a, b ; scanf("%d%d", &a, &b) ;
int l = (a ^ (last * t)) ;
int r = (b ^ (last * t)) ;
cnt[{l,r}]++ ; idx++ ;
ind[idx] = {l, r} ;
// dbg(type, l, r) ;
} else if (type == 2) {
int j ; cin >> j ;
auto c = ind[j] ;
cnt[c]-- ;
if (cnt[c] == 0) cnt.erase(c) ;
} else {
int a, b, k ;scanf("%d%d%d", &a, &b, &k) ;
int l = (a ^ (t * last)) ;
int r = (b ^ (t * last)) ;
int ans = 0 ;
for (auto [c, p] : cnt) {
auto [L, R] = c ;
L = max(L, l) , R = min(R , r) ;
if (R - L + 1 >= k) {
ans++ ;
}
}
// dbg(type, l, r) ;
printf("%d\n", ans) ;
last = ans ;
}
}
return 0 ;
}
// 希望白银
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |