Submission #343596

#TimeUsernameProblemLanguageResultExecution timeMemory
343596RakhmandSegments (IZhO18_segments)C++14
7 / 100
5074 ms1428 KiB
#include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <cmath> #include <cstdlib> #include <ctime> #include <cassert> #include <iterator> using namespace std; #define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0); #define S second #define F first #define pb push_back #define nl '\n' #define NL cout << '\n'; #define EX exit(0) #define all(s) s.begin(), s.end() #define no_answer {cout << "NO"; exit(0);} #define FOR(i, start, finish, k) for(llong i = start; i <= finish; i += k) const long long mxn = 2e5 + 110; const long long mnn = 1e3 + 2; const long long mod = 1e9 + 7; const long long inf = 1e18; const long long OO = 1e9; typedef long long llong; typedef unsigned long long ullong; int n, m, id = 0, ans = 0; pair<int, int> p[mxn]; int main() { int n, type; cin >> n >> type; while(n--){ int t; cin >> t; if(t == 1){ int l, r; cin >> l >> r; p[++id] = {l, r}; }else if(t == 2){ int x; cin >> x; p[x] = {OO, -OO}; }else{ int l, r, k; cin >> l >> r >> k; l = (l ^ (type * ans)); r = (r ^ (type * ans)); if(l > r) swap(l, r); ans = 0; for(int j = 1; j <= id; j++){ int inter = min(r, p[j].S) - max(p[j].F, l) + 1; if(inter >= k){ ans++; } } cout << ans << nl; } } } /* 5 4 4 1 2 3 1 4 3 5 3 4 5 2 3 2 1 3 1 1 3 5 2 3 4 5 2 1 3 1 6 1 1 1 2 3 2 4 2 1 3 5 3 2 3 1 2 1 3 0 3 1 6 0 1 3 10 1 3 5 3 6 10 6 2 1 1 3 10 3 6 4 2 */
#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...