#include<bits/stdc++.h>
int query(int a,int b,int c,int d);
int t[1010];
void sp(int nod, int* Left, int* Right)
{
if(nod==-1)
return;
sp(Left[nod],Left,Right);
sp(Right[nod],Left,Right);
std::swap(Left[nod],Right[nod]);
return;
}
int solve(int N, int* Left, int* Right)
{
int n=N;
for(int i=0;i<n;++i)
{
t[i]=-1;
Left[i]=Right[i]=-1;
}
for(int i=0;i+1<n;++i)
{
if(query(i,i,i,i+1)==true)
{
t[i+1]=i;
Right[i]=i+1;
}
else
{
int x=t[i];
if(x==-1)
x=i;
while(t[x]!=-1&&query(x,i+1,i+1,i+1)==true)
x=t[x];
if(t[x]==-1)
{
Left[i+1]=x;
t[x]=i+1;
}
else
{
Right[t[x]]=i+1;
t[i+1]=t[x];
t[x]=i+1;
Left[i+1]=x;
}
}
}
for(int i=0;i<n;++i)
if(t[i]==-1)
return i;
}
Compilation message
popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
52 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
596 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
448 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |