Submission #109616

#TimeUsernameProblemLanguageResultExecution timeMemory
109616youssefbou62Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include  <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define pb push_back
int press (string s ){cout<<"query "<<s<<endl; 
	int x ; cin>> x ; return x ; 
}
string guess_sequence (int n){
		string buttons ,s;  
		if( press("A")==1 ) s.pb('A') , buttons = "BXY" ;
		else if( press("B")==1 ) s.pb('B') , buttons = "AXY" ;
		else if( press("X")==1 ) s.pb('X') , buttons = "ABY" ;
		else  s.pb('Y' ) , buttons = "ABX" ; 
		
		while ( (int)s.length() != n ){
		string s2 = s ; 
		for(int i = 0 ; i < 4*n-1 ; i++ ) s2.pb(buttons[0]); 
		int ans = press ( s2 ) ; 
		while ( ans > (int)s.length() ) s.pb(buttons[0]) ; 
		 s2=s ; 
		for(int i = 0 ; i < 4*n-1 ; i++ ) s2.pb(buttons[1]); 
		 ans = press ( s2 ) ; 
		while ( ans > (int)s.length() ) s.pb(buttons[1]) ;
		 
		 s2=s ; 
		for(int i = 0 ; i < 4*n-1 ; i++ ) s2.pb(buttons[2]); 
		 ans = press ( s2 ) ; 
		while ( ans > (int)s.length() ) s.pb(buttons[2]) ;  
		}
		
		assert( (int)s.length() == n) ; 
		return s ; 
}


int main(){int n ; cin>> n ; 
	cout<<"answer is "<<guess_sequence(n)<<endl; 
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccWaCPGv.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccWSruet.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccWaCPGv.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWSruet.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status