Submission #114510

# Submission time Handle Problem Language Result Execution time Memory
114510 2019-06-01T13:51:21 Z tinjyu Highway Tolls (IOI18_highway) C++14
5 / 100
31 ms 4804 KB
#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]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 3 ms 248 KB Output is correct
4 Correct 3 ms 248 KB Output is correct
5 Correct 3 ms 248 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 248 KB Output is correct
8 Correct 3 ms 248 KB Output is correct
9 Correct 3 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 2 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 768 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 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 25 ms 4804 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 4744 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -