제출 #1143714

#제출 시각아이디문제언어결과실행 시간메모리
1143714sanoHotter Colder (IOI10_hottercolder)C++20
컴파일 에러
0 ms0 KiB
//#include "grader.h"
#include<iostream>
#include<vector>

using namespace std;

int Guess(int x) {
	cout << "otazka " << x << '\n';
	int q; cin >> q;
	return q;
}

int ries1(int l, int r) {
	if (l == r) return l;
	if (r - l < 3) {
		Guess(l);
		int x = Guess(r);
		if (x == 0) return (l + r) / 2;
		if (x == -1) return l;
		if (x == 1) return r;
	}
	Guess(l);
	int p2 = l + ((r - l) / 3) * 2;
	int x = Guess(p2);
	if (x == -1) {
		return ries1(l, (l+p2)/2 - ((l+p2) % 2 == 0));
	}
	if (x == 1) {
		x = Guess(p2 + 1);
		if (x == -1) return ries1((l + p2) / 2 + 1, p2);
		if (x == 1) return ries1(p2 + 1, r);
	}
	if (x == 0) {
		return (l + p2) / 2;
	}
	return -1;
}

int HC(int n) {
	return ries1(1, n);
}

int main() {
	int n; cin >> n;
	cout << HC(n) << '\n';
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccSvvNkO.o: in function `Guess(int)':
grader.cpp:(.text+0x0): multiple definition of `Guess(int)'; /tmp/ccYBZkbx.o:hottercolder.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccSvvNkO.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccYBZkbx.o:hottercolder.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status