Submission #220618

#TimeUsernameProblemLanguageResultExecution timeMemory
220618Coroian_DavidCombo (IOI18_combo)C++11
Compilation error
0 ms0 KiB
std::string guess_sequence(int N) { using namespace std; string s; s.clear(); char ch[4] = {'A', 'B', 'X', 'Y'}; int poz = 0; int x = press("AB"); cout << "INTREB AB REZ = " << x << "\n"; if(x >= 1) { int y = press("A"); poz = (y == 1 ? 0 : 1); } else { int y = press("X"); poz = (y == 1 ? 2 : 3); } swap(ch[0], ch[poz]); s.resize(1); s[0] = ch[0]; string a; a.clear(); for(int i = 1; i < N - 1; i ++) { a = s + ch[2] + s + ch[3] + ch[1] + s + ch[3] + ch[2] + s + ch[3] + ch[3]; int x = press(a) - i; s.resize(i + 1); s[i] = ch[1 + x]; } x = press(s + ch[1] + s + ch[2]); if(x == N) { int y = press(s + ch[1]); s.resize(N); s[N - 1] = (y == N ? ch[1] : ch[2]); } else { s.resize(N); s[N - 1] = ch[3]; } return s; }

Compilation message (stderr)

combo.cpp:1:6: error: 'string' in namespace 'std' does not name a type
    1 | std::string guess_sequence(int N) {
      |      ^~~~~~
combo.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | std::string guess_sequence(int N) {