Submission #1129402

#TimeUsernameProblemLanguageResultExecution timeMemory
1129402GraySegments (IZhO18_segments)C++20
7 / 100
5093 ms5276 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define ff first #define ss second #define ln "\n" #define mp make_pair const ll INF = 2e18; const ll MOD = 1e9+7; void solve(){ ll n, t; cin >> n >> t; ll id=1; set<pair<ll, pair<ll, ll>>> elem; ll lastans=0; while (n--){ ll typ; cin >> typ; if (typ==1){ ll a, b; cin >> a >> b; a^=(t*lastans); b^=(t*lastans); if(a>b) swap(a, b); // cout << id << "-" << a << "-" << b << ln; elem.insert({id, {a, b}}); id++; }else if (typ==2){ ll x; cin >> x; // cout << x << "-" << (*elem.lower_bound({x, {0, 0}})).ff << ln; elem.erase(elem.lower_bound({x, {0, 0}})); }else{ ll l, r, k; cin >> l >> r >> k; l^=(t*lastans); r^=(t*lastans); if (l>r) swap(l, r); ll res=0; for (auto &ch:elem){ if (min(ch.ss.ss, r)-max(ch.ss.ff, l)+1>=k) res++; } cout << res << ln; lastans=res; } } } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); auto start = chrono::high_resolution_clock::now(); ll t=1; // cin >> t; while (t--) solve(); #ifdef LOCAL auto duration = chrono::duration_cast<chrono::microseconds>(chrono::high_resolution_clock::now() - start); cout << setprecision(0) << fixed << "time: " << (double)duration.count()/1000.0 << " milliseconds" << endl; #endif }
#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...