Submission #1295439

#TimeUsernameProblemLanguageResultExecution timeMemory
1295439jahongirTraffickers (RMI18_traffickers)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;


int query(string s);

string guess(int n, int s){
	string tmp = "a";
	int m = tmp.size();

	while(m <= n){
		bool st = 0;
		for(int i = 0; i < s; i++){
			tmp[m-1] = char(i+'a');
			if(query(tmp)==m){
				st = 1; break;
			}
		}
		if(!st) break;
		tmp += 'a'; m++;
	}

	tmp.pop_back(); m--;

	int cnt = 0;
	for(int i = m-1; i >= 0 && m<n && cnt < 4; cnt++){
		bool st = 0; tmp.insert(tmp.begin()+i,'a');
		i++,m++;
		for(int j = 0; j < s; j++){
			tmp[i-1] = char(j+'a');
			if(query(tmp)==m){
				st = 1; break;
			}
		}
		if(st==0){
			m--, i--; tmp.erase(tmp.begin()+i);
		}
	}

	return tmp;
}

Compilation message (stderr)

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: /tmp/ccJAGESh.o: in function `guess[abi:cxx11](int, int)':
traffickers.cpp:(.text+0x16a): undefined reference to `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: traffickers.cpp:(.text+0x2a2): undefined reference to `query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status