이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <queue>
using namespace std;
const long long oo = 1000000000000000000;
long long int sum, ans = 0, mx = 0, mn = 1000000000, num, pos;
/*
ViHHiPuh
(( `'-""``""-'` ))
)-__-_.._-__-(
/ --- (o _ o) --- \
\ .-* ( .0. ) *-. /
_'-. ,_ '=' _, .-'_
/ `;#'#'# - #'#'#;` \
\_)) -----'#'----- ((_/
# --------- #
'# ------- ------ #'
/..-'# ------- #'-.\
_\...-\'# -- #'/-.../_
((____)- '#' -(____))
cout << fixed << setprecision(6) << x;
freopen ( "sum.in", "r", stdin )
*/
set <pair<int, pair<int, int> > > st;
int main () {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m, t, l, r, x, ll, rr;
cin >> n >> m;
ans = 0;
while ( n -- ) {
cin >> t >> l;
if ( t == 1 ) {
cin >> r;
l = ( l ^ ( m * ans ) );
r = ( r ^ ( m * ans ) );
if ( l > r )
swap( l, r );
num ++;
st.insert( { num, make_pair( l, r ) } );
}
else if ( t == 2 ) {
st.erase( st.lower_bound( { l, make_pair( 0, 0 ) } ) );
}
else {
cin >> r >> x;
l = ( l ^ ( m * ans ) );
r = ( r ^ ( m * ans ) );
if ( l > r )
swap( l, r );
ans = 0;
for ( auto i : st ) {
if ( i.second.second >= l && i.second.first <= r ) {
ll = max( i.second.first, l );
rr = min( i.second.second, r );
if ( rr - ll + 1 >= x )
ans ++;
}
}
cout << ans << "\n";
}
}
}
# | 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... |