Submission #427773

#TimeUsernameProblemLanguageResultExecution timeMemory
427773jk410Combo (IOI18_combo)C++17
100 / 100
52 ms684 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string cmp,S; S=(press("AB")?(press("A")?"A":"B"):(press("X")?"X":"Y")); if (N==1) return S; if (S=="A") cmp="BXY"; else if (S=="B") cmp="AXY"; else if (S=="X") cmp="ABY"; else cmp="ABX"; for (int i=2; i<N; i++){ int p=press(S+cmp[0]+cmp[0]+S+cmp[0]+cmp[1]+S+cmp[0]+cmp[2]+S+cmp[1]); if (p==i+1) S=S+cmp[0]; else if (p==i) S=S+cmp[1]; else S=S+cmp[2]; } if (press(S+cmp[0])==N) S=S+cmp[0]; else if (press(S+cmp[1])==N) S=S+cmp[1]; else S=S+cmp[2]; return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:5: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   29 |     else
      |     ^~~~
combo.cpp:31:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   31 |  return S;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...