#include<bits/stdc++.h>
int query(int a,int b,int c,int d);
int t[1010];
int tata(int nod)
{
if(t[nod]==-1)
return nod;
return tata(t[nod]);
}
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];
while(x!=-1&&query(x,i+1,i+1,i+1)==true)
x=t[x];
if(x==-1)
{
x=tata(i);
Left[i+1]=x;
t[x]=i+1;
}
else
{
x=Right[x];
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:49:1: warning: control reaches end of non-void function [-Wreturn-type]
49 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
5 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
692 KB |
Output is correct |
2 |
Correct |
61 ms |
928 KB |
Output is correct |
3 |
Correct |
36 ms |
676 KB |
Output is correct |
4 |
Correct |
62 ms |
448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
63 ms |
436 KB |
Output is correct |
2 |
Correct |
59 ms |
424 KB |
Output is correct |
3 |
Correct |
77 ms |
592 KB |
Output is correct |
4 |
Correct |
52 ms |
836 KB |
Output is correct |