Submission #868116

#TimeUsernameProblemLanguageResultExecution timeMemory
86811612345678Segments (IZhO18_segments)C++17
7 / 100
12 ms1500 KiB
#include <bits/stdc++.h> using namespace std; int x, q, a, b, l, r, lst, k, t; vector<pair<int, int>> v; bool d[5005]; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>q>>x; while (q--) { cin>>t; if (t==1) { cin>>a>>b; l=a^(lst*x); r=b^(lst*x); v.push_back({l, r}); } if (t==2) { cin>>a; a--; d[a]=1; } if (t==3) { cin>>a>>b>>k; int res=0; l=a^(lst*x); r=b^(lst*x); if (l>r) swap(l, r); for (int i=0; i<v.size(); i++) { if (d[i]) continue; if (min(v[i].second, r)-max(v[i].first, l)+1>=k) res++; } lst=res; cout<<res<<'\n'; } } }

Compilation message (stderr)

segments.cpp: In function 'int main()':
segments.cpp:36:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |             for (int i=0; i<v.size(); i++)
      |                           ~^~~~~~~~~
#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...