#include "highway.h"
#include <iostream>
using namespace std;
int m,ans[1000005];
int find(int s,int e)
{
std::vector<int> w(m);
for(int i=0;i<=m;i++)
{
w[i] = 0;
}
for(int i=s;i<=e;i++)
{
w[i]=1;
}
int t=ask(w);
if(t==e-s+1)
{
for(int i=s;i<=e;i++)
{
ans[0]++;
ans[ans[0]]=i;
}
}
else if(t==0)return 0;
else
{
find(s,(s+e)/2);
find((s+e)/2,e);
}
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
m = U.size();
find(0,m);
int s=N+1,t=0;
for(int i=1;i<=ans[0];i++)
{
s=min(ans[i],s);
t=max(ans[i]+1,t);
}
answer(s, t);
}
Compilation message
highway.cpp: In function 'int find(int, int)':
highway.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
760 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
4396 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
632 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
4840 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
4808 KB |
Output is incorrect: more than 100 calls to ask. |
2 |
Halted |
0 ms |
0 KB |
- |