Submission #41054

# Submission time Handle Problem Language Result Execution time Memory
41054 2018-02-12T07:48:22 Z pica4500 Hotter Colder (IOI10_hottercolder) C++
25 / 100
736 ms 8172 KB
#include "grader.h"

int HC(int N) {
	int lo = 1;
	int hi = N;

	int loVal;
	int hiVal;
	int midVal;
	while (lo < hi) {
		int mid = (lo + hi) / 2;
		int loMid = (lo + mid) / 2;
		int hiMid = (mid + hi) / 2;
		if ((hi - lo) >= 4) {
			loVal = Guess(lo);
			midVal = Guess(mid);
			if (midVal == -1) {
				hi = loMid;
				continue;
			}
			else if (midVal == 0) {
				return loMid;
			}
			hiVal = Guess(hi);
			if (hiVal == 1) {
				lo = hiMid + 1;
			}
			else if (hiVal == 0) {
				return hiMid;
			}
			else {
				lo = loMid + 1;
				hi = hiMid;
			}
		}
		else {
			loVal = Guess(lo);
			hiVal = Guess(hi);
			if (hiVal == 0) return mid;
			else if (hiVal == 1) lo = mid + 1;
			else hi = mid;
		}
	}
	return lo;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:7:6: warning: variable 'loVal' set but not used [-Wunused-but-set-variable]
  int loVal;
      ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 736 ms 8172 KB Output isn't correct - alpha = 0.000000000000