// 以上帝的名义
// 候选硕士
#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 ;
struct Fenwick {
vector<ll> t ;
int n;
Fenwick(int len) {
n = len ;
t.assign(n + 1, 0) ;
}
void upd(int i, ll x) {
while (i <= n) {
t[i] += x;
i += (i & (-i)) ;
}
}
ll get(int i) {
ll sum = 0 ;
while (i) {
sum += t[i] ;
i -= (i & (-i)) ;
}
return sum ;
}
ll get(int l, int r) {
return get(r) - get(l - 1) ;
}
};
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 ;
Fenwick f(n * 5) ;
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) ;
pr[++idx]= {l, r} ;
for (int j = l ; j <= r ; j++) f.upd(j, 1) ;
} else if (cmd == 2) {
int ind ; cin >> ind ;
auto c = pr[ind] ;
for (int j = c.first ; j <= c.second ; j++) f.upd(j, -1) ;
} else {
int a, b, k ; cin >> a >> b >> k ;
int l = (a ^ (last * t)) ;
int r = (b ^ (last * t)) ;
cout << "query -> " << l << ' ' << r << " " << k << "\n" ;
if (l > r) swap(l, r) ;
ll sum = f.get(l, r) ;
sum = (sum) / k ;
cout << sum << "\n" ;
last = sum ;
}
}
return 0 ;
}
// 希望白银
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5026 ms |
4956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
327 ms |
10000 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
172 ms |
10004 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |