#include "highway.h"
#include <iostream>
using namespace std;
int m,ans[1000005],tag[105],a,b;
int find(int s,int e)
{
cout<<s<<" "<<e<<endl;
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/(b-a)==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();
a=A;
b=B;
std::vector<int> w(m);
int tmp=ask(w);
if(N<=100)
{
for(int i=0;i<m;i++)
{
w[i]=1;
int t=ask(w);
if(t>tmp)
{
//cout<<i<<" "<<U[i]<<" "<<V[i]<<endl;
tag[U[i]]++;
tag[V[i]]++;
}
w[i]=0;
}
int s=-1,t=-1;
for(int i=0;i<N;i++)
{
if(tag[i]==1)
{
if(s==-1)s=i;
else t=i;
}
}
return answer(s,t);
}
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:32:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
248 KB |
Output is correct |
6 |
Correct |
3 ms |
420 KB |
Output is correct |
7 |
Correct |
3 ms |
276 KB |
Output is correct |
8 |
Correct |
3 ms |
248 KB |
Output is correct |
9 |
Correct |
2 ms |
248 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
3 ms |
248 KB |
Output is correct |
12 |
Correct |
3 ms |
296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
252 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
520 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
376 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
504 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
532 KB |
DO NOT PRINT ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |