Submission #1142692

#TimeUsernameProblemLanguageResultExecution timeMemory
1142692mifo콤보 (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; std::string guess_sequence(int n) { string pb = "ABXY"; string possibilities = ""; string p = ""; // prefix : all good if (press("AB") > 0) { if (press("A") == 1) { p += 'A'; } else { p += 'B'; } } else if (press("X") == 1) { p += 'X'; } else { p += 'Y'; } for (int i=0; i<pb.size(); ++i) { if (pb[i] == p[0]) { continue; } possibilities+=pb[i]; } // middle string : problem might be here int last_ans = 1; while(last_ans<n-1) { string toAdd = ""; toAdd+=possibilities[0]; toAdd+=p; toAdd+=possibilities[1]; for(int i=0; i<possibilities.size(); ++i) { toAdd+=possibilities[i]; if (i<possibilities.size()-1) { toAdd+=p; toAdd+=possibilities[1]; } } int ans = press(p + toAdd); if (ans-last_ans==1) { p+=possibilities[0]; } else if (ans-last_ans > 1) { p+=possibilities[1]; } else { p+=possibilities[2]; } ++last_ans; } // last char : normally all good if(press(p + possibilities[0]) == n) { p+=possibilities[0]; } else if(press(p + possibilities[1]) == n) { p+=possibilities[1]; } else { p+=possibilities[2]; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...