이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |