# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138260 | degelo | Combo (IOI18_combo) | C++17 | 2 ms | 268 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 st;
int np[2006];
/*int press(string n){
int i=0;
while(n[i]==st[i]){
i++;
}
return i;
}*/
string guess_sequence(int n){
string a[4];
string s;
int first;
bool achou=false;
for(int i=0;i<2000;i++){
np[i]=-1;
}
a[0]="A",a[1]="B",a[2]="X",a[3]="Y";
for(int i=0;i<3;i++){
int prox;
if(i==1||i==0) prox=1-i;
else prox=5-i;
if(!achou){
int t=press(a[i]+a[prox]);
if(t==1){
achou=true;
first=i;
s+=a[i];
np[2]=prox;
}
if(t==2){
achou=true;
s+=a[i];s+=a[prox];
first=i;
}
}
}
if(!achou){
s+=a[3];
first=3;
}
int p1,p2;
if(first==0||first==3){
p1=1;
p2=2;
}
else {
p1=0;
p2=3;
}
achou=false;
for(int i=s.size();i<n;i++){
int npode=1;
for(int j=0;j<4;j++){
if(!achou&&npode!=3&&j!=first){
if(np[i]==j){
npode++;
continue;
}
int prox;
if(p1==j) prox=p2;
else prox=p1;
int t=press(s+a[j]+a[prox]);
if(t==s.size()+1){
np[s.size()+1]=prox;
s+=a[j];
achou=true;
}
else if(t==s.size()+2){
i++;
s+=a[j];s+=a[prox];
achou=true;
}
else npode++;
}
else if(npode==3&&i!=first&&!achou){
s+=a[j];
achou=true;
}
}
achou=false;
}
return s;
}
/*int main()
{
cin>>st;
cout<<guess_sequence(st.size());
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |