Submission #633423

#TimeUsernameProblemLanguageResultExecution timeMemory
633423Doncho_BonbonchoCombo (IOI18_combo)C++14
100 / 100
32 ms556 KiB
#include <bits/stdc++.h> #include "combo.h" std::string guess_sequence(int N) { /* std::string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); std::string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } */ /* int fA, fB, fX; fA = press("A"); fB = press("B"); fX = press("X"); if( fA ) ans += "A"; else if( fB ) ans += "B"; else if( fX ) ans += "X"; else ans += "Y"; */ std::string ans = ""; if( press("AB") ){ if( press("A") ) ans = "A"; else ans = "B"; }else if( press("X") ) ans = "X"; else ans = "Y"; //std::cout<<" star with "<<ans<<"\n"; std::string s[3]; int ind = 0; if( ans != "A" ){ s[ind] = "A"; ind++; } if( ans != "B" ){ s[ind] = "B"; ind++; } if( ans != "X" ){ s[ind] = "X"; ind++; } if( ans != "Y" ){ s[ind] = "Y"; ind++; } /* std::cerr<<"s[0] "<<s[0]<<"\n"; std::cerr<<"s[1] "<<s[1]<<"\n"; std::cerr<<"s[2] "<<s[2]<<"\n"; */ int coins = 1; for( int i=0 ; i<N-2 ; i++ ){ std::string currS = ans + s[0] + s[0] + ans + s[0] + s[1] + ans + s[0] + s[2] + ans + s[1]; // std::cout<<currS<<"\n"; int currCoins = press(currS); if( currCoins - 2 == coins ) ans += s[0]; if( currCoins - 1 == coins ) ans += s[1]; if( currCoins == coins ) ans += s[2]; // std::cout<<"\n"<<ans<<"\n"; coins ++; } //std::cerr<<"\n!!"<<ans<<"\n"; std::string curr = ans + s[0] + s[1]; std::string curr1 = ans + s[0]; //std::cerr<<s[0]+s[1]<<" "<<press(curr)<<"\n"; //std::cerr<<s[0]<<" "<<press(curr1)<<"\n"; if( N > 1 ){ if( press( ans + s[0] ) != coins ) ans += s[0]; else if( press( ans + s[1] ) != coins ) ans += s[1]; else ans += s[2]; } //std::cout<<ans<<"\n"; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...