# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
379039 | daniel920712 | Segments (IZhO18_segments) | C++14 | 5074 ms | 8684 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |