Submission #213173

#TimeUsernameProblemLanguageResultExecution timeMemory
213173_Ice_Tea_Combo (IOI18_combo)C++14
100 / 100
42 ms660 KiB
#include<bits/stdc++.h> #include "combo.h" #define de(x) if( x && x == MODE) #define MODE 0 using namespace std; string cht; string dic[4]; std::string guess_sequence(int N) { string S; int i, j; string p; p = "AB"; if( press(p) ) { p = "A"; if( press(p) ) S = "A"; else S = "B"; } else { p = "X"; if( press(p) ) S = "X"; else S = "Y"; } if( N == 1) return S; 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]); } de(1) cout << "ans = " << S << "\n"; // assert( S.size() == N); return S; }

Compilation message (stderr)

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