# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677527 | hello_there_123 | Combo (IOI18_combo) | C++17 | 1 ms | 208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
//#include "combo.h"
using namespace std;
string arr[4]={"A","B","X","Y"};
vector<string>v;
int press(string s);
string guess_sequence(int N){
if(N==1){
for(int i=0;i<4;i++){
if(press(arr[i]) == 1) return arr[i];
}
}
else{
string ans = "";
string start = "";
for(int i=0;i<4;i++){
string tr = "";
for(int j=0;j<4;j++){
tr = tr+arr[i] + arr[j];
}
int x = press(tr);
if(x==2){
start = arr[i];
break;
}
}
ans = start;
for(int i=0;i<4;i++) if(arr[i]!=start) v.push_back(arr[i]);
for(int i=0;i<N-2;i++){
string tr = "";
tr += ans + arr[0];
tr += ans + arr[1] + arr[0];
tr += ans + arr[1] + arr[1];
tr += ans + arr[1] + arr[2];
int x = press(tr);
if(x == ans.length()) ans+=arr[2];
else if(x == ans.length() +1) ans += arr[0];
else ans += arr[1];
}
if(press(ans+arr[0]) == N) return ans+arr[0];
if(press(ans+arr[1]) == N) return ans+arr[1];
else return ans+arr[2];
}
return "";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |