Submission #770228

#TimeUsernameProblemLanguageResultExecution timeMemory
770228boyliguanhanCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string str; int res; char a,b,c; if(press("AB")) if(press("A")) str="A",a='B',b='X',c='Y'; else str="B",a='A',b='X',c='Y'; else if(press("X")) str = "X",a='Y',b='A',c='B'; else str = "Y",a='X',b='A',c='B'; if(n==a) return res; for(int i = 1; i < N-1; i++) { res = press(str+a+str+b+a+str+b+b+str+b+c); if(res==i) str+=c; if(res==i+1) str+=a; if(res==i+2) str+=b; } if(press(str+a)==N) str+=a; else if(press(str+b)==N) str+=b; else str+=c; return str; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:8: error: 'n' was not declared in this scope
   17 |     if(n==a) return res;
      |        ^
combo.cpp:17:21: error: could not convert 'res' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   17 |     if(n==a) return res;
      |                     ^~~
      |                     |
      |                     int