이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
//void press(p);
string guess_sequence(int N) {
//first letter guess
char first;
int hold= press("AB");
if(hold>=1){
hold=press("A");
if(hold==1){
first='A';
}
else{
first='B';
}
}
else{
hold=press("X");
if(hold==1){
first='X';
}
else{
first='Y';
}
}
unordered_map<string,string>mp;
unordered_map<char,char>mp2;
if(first=='A'){
mp["AB"]="XY";
mp["AX"]="XX";
mp["AY"]="XB";
mp["B"]='B';
mp2['A']='X';
mp2['B']='B';
mp2['X']='Y';
}
else if(first=='B'){
mp["AB"]="XY";
mp["AX"]="XA";
mp["AY"]="XX";
mp["B"]='A';
mp2['A']='X';
mp2['B']='A';
mp2['X']='Y';
}
else if(first=='X'){
mp["AB"]="AB";
mp["AX"]="AY";
mp["AY"]="AA";
mp["B"]='B';
mp2['A']='A';
mp2['B']='B';
mp2['X']='Y';
}
else{ //Y
mp["AB"]="AB";
mp["AX"]="AX";
mp["AY"]="AA";
mp["B"]='B';
mp2['A']='A';
mp2['B']='B';
mp2['X']='X';
}
//normal guess
string ans="";
ans.push_back(first);
for(int x=1;x<N-1;x++){
hold=press(ans+mp["AB"]+ans+mp["AX"]+ans+mp["AY"]+ans+mp["B"]);
if(hold==x+2){
ans.push_back(mp2['A']);
}
else if(hold==x+1){
ans.push_back(mp2['B']);
}
else{
ans.push_back(mp2['X']);
}
}
//last guess
if(N>1){
hold=press(ans+"A"+ans+"B");
if(hold==N){
hold=press(ans+"A");
if(hold==N){
ans.push_back('A');
}
else{
ans.push_back('B');
}
}
else{
hold=press(ans+"X");
if(hold==N){
ans.push_back('X');
}
else{
ans.push_back('Y');
}
}
}
//cout << ans << " guess\n";
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |