Submission #232636

#TimeUsernameProblemLanguageResultExecution timeMemory
232636pere_gilCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <iostream> using namespace std; std::string guess_sequence(int N){ string s="",rest=""; if(press("AB")>0){ if(press("A")>0){ s="A"; rest="BXY"; } else{ s="B"; rest="AXY"; } } else{ if(press("X")>0){ s="X"; res="ABY"; } else{ s="Y"; rest="ABX"; } } int compl=1; while(compl<N){ string supose=s+rest[0]+rest[0]+s+rest[0]+rest[1]+s+rest[0]+rest[2]+s+rest[1]; int a=press(supose); if(a==compl+2){ s+=rest[0]; a++; } else{ if(a==compl+1){ s+rest[1]; a++; } else{ if(a==compl){ s+=rest[2]; a++; } } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:34: error: 'res' was not declared in this scope; did you mean 'rest'?
   13 |         if(press("X")>0){ s="X"; res="ABY"; }
      |                                  ^~~
      |                                  rest
combo.cpp:16:14: error: expected class-name before '=' token
   16 |     int compl=1;
      |              ^
combo.cpp:17:16: error: expected primary-expression before '<' token
   17 |     while(compl<N){
      |                ^
combo.cpp:23:30: error: expected primary-expression before ')' token
   23 |             else{ if(a==compl){ s+=rest[2]; a++; } }
      |                              ^