# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82435 | farukkastamonuda | Combo (IOI18_combo) | C++14 | 2 ms | 220 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 "combo.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long
#define inf 1000000009
#define md 1000000007
#define li 100005
#define mp make_pair
#define pb push_back
#define mid (start+end)/2
using namespace std;
int n;
string y,ana;
char ilk;
string guess_sequence(int N){
n=N;
y="AB";
if(press(y)>=1){
y="A";
if(press(y)>=1){
ilk='A';
}
else ilk='B';
}
else{
y='C';
if(press(y)>=1){
ilk='C';
}
else ilk='D';
}
ana=ana+ilk;
for(int i=2;i<=n-1;i++){
string t=ana;
int uz=i-1;
if(ilk=='A'){
t=t+'B';
t=t+ana+'X'+'X';
t=t+ana+'X'+'Y';
t=t+ana+'X'+'B';
int sonuc=press(t);
if(sonuc==uz){
ana=ana+'Y';
}
else if(sonuc==uz+1){
ana=ana+'B';
}
else ana=ana+'X';
}
else if(ilk=='B'){
t=t+'A';
t=t+ana+'X'+'X';
t=t+ana+'X'+'Y';
t=t+ana+'X'+'A';
int sonuc=press(t);
if(sonuc==uz){
ana=ana+'Y';
}
else if(sonuc==uz+1){
ana=ana+'A';
}
else ana=ana+'X';
}
else if(ilk=='X'){
t=t+'B';
t=t+ana+'A'+'A';
t=t+ana+'A'+'Y';
t=t+ana+'A'+'B';
int sonuc=press(t);
if(sonuc==uz){
ana=ana+'Y';
}
else if(sonuc==uz+1){
ana=ana+'B';
}
else ana=ana+'A';
}
else if(ilk=='Y'){
t=t+'B';
t=t+ana+'A'+'A';
t=t+ana+'A'+'X';
t=t+ana+'A'+'B';
int sonuc=press(t);
if(sonuc==uz){
ana=ana+'X';
}
else if(sonuc==uz+1){
ana=ana+'B';
}
else ana=ana+'A';
}
}
string g;
g.clear();
if(ilk=='A'){
g=ana+'B'+ana+'X';
int sonuc=press(g);
if(sonuc==n-1){
ana=ana+'Y';
return ana;
}
g=ana+'B';
sonuc=press(g);
if(sonuc==n-1){
ana=ana+'X';
return ana;
}
ana=ana+'B';
return ana;
}
//
if(ilk=='B'){
g=ana+'A'+ana+'X';
int sonuc=press(g);
if(sonuc==n-1){
ana=ana+'Y';
return ana;
}
g=ana+'A';
sonuc=press(g);
if(sonuc==n-1){
ana=ana+'X';
return ana;
}
ana=ana+'A';
return ana;
}
//
if(ilk=='X'){
g=ana+'B'+ana+'A';
int sonuc=press(g);
if(sonuc==n-1){
ana=ana+'Y';
return ana;
}
g=ana+'B';
sonuc=press(g);
if(sonuc==n-1){
ana=ana+'A';
return ana;
}
ana=ana+'B';
return ana;
}
if(ilk=='Y'){
g=ana+'B'+ana+'X';
int sonuc=press(g);
if(sonuc==n-1){
ana=ana+'A';
return ana;
}
g=ana+'B';
sonuc=press(g);
if(sonuc==n-1){
ana=ana+'X';
return ana;
}
ana=ana+'B';
return ana;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |