Submission #1052275

#TimeUsernameProblemLanguageResultExecution timeMemory
1052275Ahmed57Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; string guess_sequence(int N){ int a = press("AB"); string fi; if(a){ if(press("A"))fi = "A"; else fi = "B"; }else{ if(press('X'))fi = "X"; else fi = "Y"; } set<char> rem; if(fi[0]!='X')rem.insert('X'); if(fi[0]!='A')rem.insert('A'); if(fi[0]!='B')rem.insert('B'); if(fi[0]!='Y')rem.insert('Y'); vector<char> v; for(auto i:rem)v.push_back(i); for(int i = 2;i<N;i++){ string qu; qu+=fi; qu+=v[0]; qu+=v[0]; qu+=fi; qu+=v[0]; qu+=v[1]; qu+=fi; qu+=v[0]; qu+=v[2]; qu+=fi; qu+=v[1]; int an = press(qu); if(an==i-1){ fi+=v[2]; }else if(an==i){ fi+=v[1]; }else fi+=v[0]; } string qu; qu+=fi; qu+=v[0]; qu+=fi; qu+=v[1]; if(press(qu)==N){ string qu2; qu2+=fi; qu2+=v[0]; if(press(qu2)==N){ fi+=v[0]; }else fi+=v[1]; }else fi+=v[2]; return fi; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:18: error: could not convert ''X'' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   12 |         if(press('X'))fi = "X";
      |                  ^~~
      |                  |
      |                  char