Submission #125519

# Submission time Handle Problem Language Result Execution time Memory
125519 2019-07-05T15:07:04 Z arthurconmy Hotter Colder (IOI10_hottercolder) C++14
50 / 100
724 ms 8312 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
#include <chrono>
#include "grader.h"
using namespace std;
// vector<int> returns;
// int ind=0;

// int Guess(int val)
// {
// 	cout << val << endl;
// 	return returns[ind++];
// }

int HC(int N)
{
	if(N==1) return 1;

	int mid = (1+N)/2;
	int no_one_cares=Guess(mid);
	int mid_gue_bump=Guess(mid+1); // do we need to use intelligence from the previous guess???

	int l,r;
	
	if(mid_gue_bump==-1)
	{
		l=1;
		r=mid;
	}

	else
	{
		l=mid+1;
		r=N;
	}

	while(l<r)
	{
		// cout << l << " " << r << endl;

		int cur_mid=(l+r)/2;
		Guess(cur_mid);
		int cur = Guess(cur_mid+1);
	
		if(cur==-1)
		{
			r=cur_mid;
		}

		else
		{
			l=cur_mid+1;
		}
	}

	return l;

	// int g = Guess(1);
	// int h = Guess(N);
	// if (g == 0) return N/2;
	// if (g < 0) return N/4;
	// if (g > 0) return 3*N/4;
}

// int main()
// {
// 	returns={0,-1,-1,-1,-1,-1,-1,1};
// 	cout << "GUESS: " << HC(10) << endl;
// }

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:30:6: warning: unused variable 'no_one_cares' [-Wunused-variable]
  int no_one_cares=Guess(mid);
      ^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 724 ms 8312 KB Output isn't correct - alpha = 0.000000000000