Submission #343601

#TimeUsernameProblemLanguageResultExecution timeMemory
343601koketsuSegments (IZhO18_segments)C++14
7 / 100
5070 ms4928 KiB
#include <bits/stdc++.h> #define pb push_back #define LL long long #define Kultivator ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define int LL using namespace std; const LL Mxn = 1e6 + 7; const LL Mod = 1e9 + 7; const LL Inf = 1e14 + 7; bool Used[Mxn]; int N, t, Dup, lastans, Cnt; vector <pair <int, int>> g; int Check(int L, int R, int K){ int Ans = 0; for(int i = 0; i < Cnt; i++){ if(Used[i]) continue; int U = min(R, g[i].second) - max(L, g[i].first) + 1; if(U >= K) Ans++; } return Ans; } signed main(){ Kultivator; cin >> N >> t; Dup += N; while(Dup--){ int T; cin >> T; if(T == 1){ int L, R; cin >> L >> R; L = (L ^ (t * lastans)); R = (R ^ (t * lastans)); Cnt++; if(L > R) swap(L, R); g.pb({L, R}); } else if(T == 2){ int Id; cin >> Id; Used[Id - 1] = true; } else { int L, R, K; cin >> L >> R >> K; L = (L ^ (t * lastans)); R = (R ^ (t * lastans)); if(L > R) swap(L, R); lastans = Check(L, R, K); cout << lastans << '\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...