Submission #378874

#TimeUsernameProblemLanguageResultExecution timeMemory
378874daniel920712Segments (IZhO18_segments)C++14
7 / 100
5087 ms4152 KiB
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; pair < int , int > all[200005]; bool have[200005]; int main() { int N,M,ans=0,now=0,a,b,l,r,t,i; scanf("%d %d",&N,&M); while(N--) { scanf("%d",&a); if(a==1) { scanf("%d %d",&l,&r); l=l^(M*ans); r=r^(M*ans); now++; have[now]=1; all[now]=make_pair(l,r); } else if(a==2) { scanf("%d",&l); have[l]=0; } else { scanf("%d %d %d",&l,&r,&t); l=l^(M*ans); r=r^(M*ans); ans=0; if(l>r) swap(l,r); for(i=1;i<=now;i++) { if(have[i]==0) continue; a=max(l,all[i].first); b=min(r,all[i].second); if(b-a+1>=t) ans++; } printf("%d\n",ans); } } return 0; } /* 6 0 1 3 10 1 3 5 3 6 10 6 2 1 1 3 10 3 6 4 2 */

Compilation message (stderr)

segments.cpp: In function 'int main()':
segments.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
segments.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |         scanf("%d",&a);
      |         ~~~~~^~~~~~~~~
segments.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |             scanf("%d %d",&l,&r);
      |             ~~~~~^~~~~~~~~~~~~~~
segments.cpp:26:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |             scanf("%d",&l);
      |             ~~~~~^~~~~~~~~
segments.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   31 |             scanf("%d %d %d",&l,&r,&t);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...