제출 #379039

#제출 시각아이디문제언어결과실행 시간메모리
379039daniel920712Segments (IZhO18_segments)C++14
7 / 100
5074 ms8684 KiB
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; pair < int , int > all[200005]; bool have[200005]; struct A { int here; int nxl,nxr; bool have; int sz; int con; int rnd; }Node[500005]; int root1=0; int root2=2e5+50; int st1=0; int st2=2e5+50; int Merge(int a,int b) { if(a==st1||a==st2) return b; if(b==st1||b==st2) return a; if(Node[a].rnd>Node[b].rnd) { Node[a].nxr=Merge(Node[a].nxr,b); //UPD(a); return a; } else { Node[b].nxl=Merge(a,Node[b].nxl); //UPD(b); return b; } } /*pair < int , int > split(int here,int con) { if(here==st1||here==st2) return make_pair(here,here); }*/ 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); Node[st1+now].here=l; Node[st1+now].have=1; Node[st2+now].here=r; Node[st2+now].have=1; } 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 */

컴파일 시 표준 에러 (stderr) 메시지

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