Submission #211043

#TimeUsernameProblemLanguageResultExecution timeMemory
211043Seanliu콤보 (IOI18_combo)C++14
0 / 100
1 ms328 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){ current = "A"; r = press(current); if(r) c = "ABXY"; else c = "BAXY"; } else { current = "Y"; r = press(current); if(r) 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(); } tmp.clear(); for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]); tmp.push_back(1); for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]); tmp.push_back(2); if(press(getStr()) == N){ tmp.clear(); for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]); tmp.push_back(1); if(press(getStr()) == N) return getStr(); tmp[N - 1] = 2; return getStr(); } tmp.clear(); for(int j = 0; j < N - 1; j++) tmp.push_back(ans[j]); tmp.push_back(3); }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:19: warning: control reaches end of non-void function [-Wreturn-type]
   22 |  string current = "AB";
      |                   ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...