Submission #321036

#TimeUsernameProblemLanguageResultExecution timeMemory
321036gustasonCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#include "combo.h" using namespace std; int press(string s) { int a; cout << s << "\n"; cin >> a; return a; } string guess_sequence(int N) { string keys[] = {"A", "B", "X", "Y"}; string S = ""; if (press("AB") >= 1) { if (press("A") == 1) { S += 'A'; } else { S += 'B'; } } else { if (press("X") >= 1) { S += 'X'; } else { S += 'Y'; } } vector<string> add; if (S == "B") { add.push_back("X"); } else { add.push_back("B"); } string fr; if (S == "X") { fr += "B"; } else { fr += "X"; } vector<string> keys2; for(int i = 0; i < 4; i++) { if (keys[i] == S) continue; keys2.push_back(keys[i]); add.push_back(fr + keys[i]); } int sz = 1; for(int i = 1; i < N-1; i++, sz++) { int p = press(S + add[0] + S + add[1] + S + add[2] + S + add[3]); if (p == sz) { S += add[3][1]; } else if (p == sz + 1) { S += add[0][0]; } else { S += add[1][0]; } } if (press(S + keys[0] + S + keys[1]) == sz) { S += keys[2]; } else { if (press(S + keys[0]) == sz + 1) { S += keys[0]; } else { S += keys[1]; } } return S; } int main() { cout << guess_sequence(3); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccotkYfL.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/ccQ9x0yL.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccotkYfL.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccQ9x0yL.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status