Submission #356457

# Submission time Handle Problem Language Result Execution time Memory
356457 2021-01-23T11:46:33 Z Mefarnis Hotter Colder (IOI10_hottercolder) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

void HC(int n) {
	int l = 1 , r = n , last = 1;
	Guess(last);
	while(l < r) {
		int mid = (l+r) >> 1;
		int x = (last == l) ? r : l;
		int val = Guess(x);
		if(val == 0)
			return mid;
		int y = (val == 1) ? x : last;
		if((l+r)%2 == 0) {
			if(y == l)
				r = mid-1;
			else
				l = mid+1;
		}
		else {
			if(y == l)
				r = mid;
			else
				l = mid+1;
		}
		last = x;
	}
	return l;
}

Compilation message

hottercolder.cpp: In function 'void HC(int)':
hottercolder.cpp:13:11: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |    return mid;
      |           ^~~
hottercolder.cpp:29:9: error: return-statement with a value, in function returning 'void' [-fpermissive]
   29 |  return l;
      |         ^