Submission #1014490

#TimeUsernameProblemLanguageResultExecution timeMemory
1014490nisanduuCombo (IOI18_combo)C++14
0 / 100
1 ms364 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; // int press(string s){ // if(s=="X") return 1; // if(s=="XB") return 2; // if(s == "XBA") return 3; // return 0; // } string guess_sequence(int n){ string st = ""; char ct = 'A'; for(ll i=0;i<26;i++){ char x = ('A'+i); string tmp = "";; tmp += x; if(press(tmp)==1){ st = tmp; ct = x; break; } } string ans = st; vector<char> other = {'A','B','X','Y'}; auto ite = find(other.begin(),other.end(),ct); other.erase(ite); for(ll i=1;i<n;i++){ for(ll j=0;j<3;j++){ string tm = ans; tm += other[j]; if(press(tm)==(i+1)){ ans = tm; break; } } } return ans; } // int main() // { // cout<<guess_sequence(3); // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...