Submission #135171

#TimeUsernameProblemLanguageResultExecution timeMemory
135171Adhyyan1252Combo (IOI18_combo)C++11
100 / 100
52 ms484 KiB
#include<string.h> #include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { int n = N; //find first lette string s = "ABXY"; char f; string a = "AX"; if(press("AB")){ if(press("A")){ f = 'A'; }else{ f = 'B'; } }else{ if(press("X")){ f = 'X'; }else{ f = 'Y'; } } //cout<<"WTf"<<endl; s.erase(s.find(f), 1); string ret = ""; ret += f; //cout<<"S "<<s<<endl; //cout<<"RE: "<<ret<<endl; //cout<<"F: "<<f<<endl; for(int i = 1; i < N-1; i++){ string t = ret + s[0] + ret + s[1] + s[0] + ret + s[1] + s[1] + ret + s[1] + s[2]; //cout<<"STRING "<<t<<endl; int coins = press(t); if(coins == i){ ret += s[2]; }else if(coins == i+1){ ret += s[0]; }else{ ret += s[1]; } } if(N > 1){ if(press(ret + s[0] + ret + s[1]) == n){ if(press(ret + s[0]) == n){ ret += s[0]; }else{ ret += s[1]; } }else{ ret += s[2]; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...