Submission #213163

#TimeUsernameProblemLanguageResultExecution timeMemory
213163_Ice_Tea_Combo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" #define de(x) if( x && x == MODE) #define MODE 1 using namespace std; string cht; string dic[4]; std::string guess_sequence(int N) { string S; int i, j; string p; if( p = "AB", press(p) ) { if( p = "A", press(p) ) S = "A"; else S = "B"; } else { if( p = "X", press(p)) S = "X"; else S = "Y"; } if( S == "A") { dic[0] = "BB"; dic[1] = "BX"; dic[2] = "BY"; dic[3] = "X"; cht = "BXY"; } else if( S == "B") { dic[0] = "AA"; dic[1] = "AX"; dic[2] = "AY"; dic[3] = "X"; cht = "AXY"; } else if( S == "X") { dic[0] = "AA"; dic[1] = "AB"; dic[2] = "AY"; dic[3] = "B"; cht = "ABY"; } else if( S == "Y") { dic[0] = "AA"; dic[1] = "AB"; dic[2] = "AX"; dic[3] = "B"; cht = "ABX"; } for( i=1; i<N-1; i++) { p = S + dic[0] + S + dic[1] + S + dic[2] + S + dic[3]; de(1) cout<<"ask>> "<<p<<"\n"; int q = press(p); if( q == i + 2) S.push_back(cht[0]); else if( q == i + 1) S.push_back(cht[1]); else S.push_back(cht[2]); de(1) cout << "S = " << S << "\n"; } p = S + cht[0] + S + cht[1]; if( press(p) == N) { p = S + cht[0]; if( press(p) == N) S.push_back(cht[0]); else S.push_back(cht[1]); } else { S.push_back(cht[2]); } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:12: warning: unused variable 'j' [-Wunused-variable]
   16 |     int i, j;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...