Submission #526317

#TimeUsernameProblemLanguageResultExecution timeMemory
526317benson1029Combo (IOI18_combo)C++14
5 / 100
1 ms256 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; vector<char> v = {'A', 'B', 'X', 'Y'}; char xth(int x, char ex) { for(char i:v) { if(i!=ex) { x--; if(x==0) return i; } } } std::string guess_sequence(int N) { string ans; if(press("AB")) { if(press("A")) ans = "A"; else ans = "B"; } else { if(press("X")) ans = "X"; else ans = "Y"; } for(int i=2; i<N; i++) { int tmp = press(ans + xth(1, ans[0]) + ans + xth(2, ans[0]) + xth(1, ans[0]) + ans + xth(2, ans[0]) + xth(2, ans[0]) + ans + xth(2, ans[0]) + xth(3, ans[0])); if(tmp==i) ans += xth(1, ans[0]); else if(tmp==i+1) ans += xth(2, ans[0]); else ans += xth(3, ans[0]); } if(press(ans + xth(1, ans[0]))==N) ans += xth(1, ans[0]); else if(press(ans + xth(2, ans[0]))==N) ans += xth(2, ans[0]); else ans += xth(3, ans[0]); return ans; }

Compilation message (stderr)

combo.cpp: In function 'char xth(int, char)':
combo.cpp:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...