Submission #1016522

#TimeUsernameProblemLanguageResultExecution timeMemory
1016522vjudge1Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
	string s = "";
	string chars;
	// find first button
	int f = press("AB");
	if(f>=1){
		int ff = press("A");
		if(ff==1) {
			chars = "BXY";
			s = "A";
		}
		else{
			chars = "AXY";
			s = "B";
		}
	}
	else{
		int ff = press("X");
		if(ff==1){
			chars = "ABY";
			s = "X";
		}
		else{
			chars = "ABX";
			s = "Y";
		}
	}
	if(N==1) return s;
	
	// find 2nd to 2nd last button
	for (int i=2; i<N; i++){
		string qry = s+chars[1] + s+chars[2]+chars[0] + s+chars[2]+chars[1] + s+chars[2]+chars[2];
		int coins = press(qry);
		if(coins==i-1) s += chars[0];
		else if(coins==i) s += chars[1];
		else s += chars[2];
	}
	
	// find last button
	int l = press(s+chars[0]);
	if(l==N) s += chars[0];
	else{
		int ll = press(s+chars[1]);
		if(ll==N) s += chars[1];
		else s += chars[2];
	}
	return s;
}

signed main(){
	int n;
	cin >> n;
	cout << guess_sequence(n) << endl;
	return 0;
}

Compilation message (stderr)

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