Submission #211027

#TimeUsernameProblemLanguageResultExecution timeMemory
211027SeanliuCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <string> #include "combo.h" #include <vector> #include <deque> using namespace std; const int maxN = 2e3 + 10; int ans[maxN]; string c; vector<int> tmp; string getStr(){ string s = ""; for(int x : tmp) s += c[x]; return s; } std::string guess_sequence(int N) { int r; c = ""; string current = "AB"; r = press(current); if(r == 1){ current = "A"; r = press(current); if(r == 1) c = "ABXY"; else r = "BAXY"; } else { current = "Y"; r = press(current); if(r == 1){ c = "YABX"; } else { c = "XABY"; } } for(int i = 1; i < N - 1; i++){ tmp.clear(); for(int j = 0; j < i; j++) tmp.push_back(ans[j]); tmp.push_back(1); for(int j = 0; j < i; j++) tmp.push_back(ans[j]); tmp.push_back(2); tmp.push_back(1); for(int j = 0; j < i; j++) tmp.push_back(ans[j]); tmp.push_back(2); tmp.push_back(2); for(int j = 0; j < i; j++) tmp.push_back(ans[j]); tmp.push_back(2); tmp.push_back(3); r = press(getStr()); if(r == i) ans[i] = 3; else if(r == i + 1) ans[i] = 1; else ans[i] = 2; } if(N == 1){ tmp.push_back(0); return getStr(); } for(int i = 1; i < 4; i++){ tmp.clear(); for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]); tmp.push_back(i); if(press(getStr()) == N) return getStr(); } return getStr(); }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
   28 |   else r = "BAXY";
      |            ^~~~~~
      |            |
      |            const char*