제출 #495772

#제출 시각아이디문제언어결과실행 시간메모리
495772vinnipuh01Segments (IZhO18_segments)C++17
7 / 100
5098 ms5136 KiB
#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 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...