Submission #1160883

#TimeUsernameProblemLanguageResultExecution timeMemory
1160883AzaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <string> #include <iostream> #define size(x) (int)x.size() using namespace std; int press(string p){ cout << p << endl; int ret; cin >> ret; return ret; } string guess_sentence(int n){ string s; string g = "ABXY"; char ign = 'A'; for(int i = 0; i < 4; i++){ string h; h += g[i]; if(press(h) == 1){ s += h; ign = g[i]; break; } } string gg; for(char ch:g){ if(ch == ign)continue; gg += ch; } g = gg; while(size(s) != n){ bool did = false; for(int i = 0; i < 2; i++){ s += g[i]; if(press(s) == size(s)){ did = true; break; } s.pop_back(); } if(!did){ s += g[2]; } } return s; } int main(){ //ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n; cin >> n; cout << guess_sentence(n); } /* */

Compilation message (stderr)

/usr/bin/ld: /tmp/cczQQHXn.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/ccQso6u2.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/cczQQHXn.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccQso6u2.o:combo.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cczQQHXn.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status