# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
850524 | askow | Combo (IOI18_combo) | C++14 | 0 ms | 344 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;
/*
int N;
string S="ABXYB";
int press(std::string p) {
int len = p.length();
if (len > 4 * N) {
//wrong_answer("invalid press");
}
for (int i = 0; i < len; ++i) {
if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') {
//wrong_answer("invalid press");
}
}
int coins = 0;
for (int i = 0, j = 0; i < len; ++i) {
if (j < N && S[j] == p[i]) {
++j;
} else if (S[0] == p[i]) {
j = 1;
} else {
j = 0;
}
coins = std::max(coins, j);
}
return coins;
}*/
std::string guess_sequence(int N) {
string pref="";
if(press("AB")){
if(press("A"))pref="A";
else pref="B";
}
else {
if(press("X"))pref="X";
else pref="Y";
}
vector<char>probaj;
if(pref[0]!='A')probaj.push_back('A');
if(pref[0]!='B')probaj.push_back('B');
if(pref[0]!='X')probaj.push_back('X');
if(pref[0]!='Y')probaj.push_back('Y');
//for(auto it:probaj)cout<<it<<" ";
//cout<<endl;
for(int i=1;i<=N-2;i++){
string pitam="";
for(int j=0;j<3;j++){
pitam+=pref;
pitam+=probaj[0];
pitam+=probaj[j];
}
pitam+=pref;
pitam+=probaj[1];
int x=press(pitam);
//cout<<x<<" "<<pitam;
//cout<<endl;
if(x==pref.size())pref+=probaj[2];
else if(x==pref.size()+1)pref+=probaj[1];
else pref+=probaj[2];
}
if(N>1){
if(press(pref+probaj[0]+pref+probaj[1])){
if(press(pref+probaj[0]))pref+=probaj[0];
else pref+=probaj[1];
}
else pref+=probaj[2];
}
return pref;
}/*
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
cout<<guess_sequence(n);
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |