Submission #41047

# Submission time Handle Problem Language Result Execution time Memory
41047 2018-02-12T07:18:20 Z didwlvv Hotter Colder (IOI10_hottercolder) C++14
0 / 100
795 ms 21624 KB
#include "grader.h"
#include<cstdio>
#include<cmath>
int HC(int N){
	Guess(N);
	int cnt = 1;
	int le = 1;
	int ri = N;
	int g = N;
	bool f = true;
	while (le < ri) {
		int mid = (le + ri) / 2;
		int ok = Guess(mid);
		if (f) {
			if (ok == 1) {
				int ook = Guess(mid - 1);
				g = mid - 1;
				if (ook == 1) {
					ri = mid-1;

				}
				else if (ook == -1) {
					le = mid;
					f = 0;
				}

			}
			else if (ok == -1) {
				g = mid;
				le = mid + (ri - mid) / 2;
			}
			else {
				return mid + (g - mid) / 2;
			}
		}
		else{
			if (ok == 1) {
				int ook = Guess(mid + 1);
				g = mid + 1;
				if (ook == 1) {
					le = mid + 1;

				}
				else if (ook == -1) {
					ri = mid;
					f = 1;
				}

			}
			else if (ok == -1) {
				g = mid;
				ri = mid + (mid - le) / 2;
			}
			else {
				return mid + (g - mid) / 2;
			}
		}

	}
	return le;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:6:6: warning: unused variable 'cnt' [-Wunused-variable]
  int cnt = 1;
      ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 2936 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 2936 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 2936 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 795 ms 21624 KB Output isn't correct - alpha = 0.000000000000