# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
534446 | YaserFaisal | Combo (IOI18_combo) | C++17 | 0 ms | 0 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 call( string cur )
{
int siz = cur.size()+1 ;
if ( cur[0] == 'A' )
{
if ( press(cur+'B') == siz ) return cur+'B' ;
else if ( press(cur+'X') == siz ) return cur+'X' ;
else return cur+'Y' ;
}
if ( cur[0] == 'B' )
{
if ( press(cur+'A') == siz ) return cur+'A' ;
else if ( press(cur+'X') == siz ) return cur+'X' ;
else return cur+'Y' ;
}
if ( cur[0] == 'X' )
{
if ( press(cur+'B') == siz ) return cur+'B' ;
else if ( press(cur+'A') == siz ) return cur+'A' ;
else return cur+'Y' ;
}
if ( cur[0] == 'Y' )
{
if ( press(cur+'B') == siz ) return cur+'B' ;
else if ( press(cur+'X') == siz ) return cur+'X' ;
else return cur+'A' ;
}
}
string guess_sequence (int n)
{
string cur = "" ;
if ( press(cur+'A') == 1 ) cur+='A' ;
else if ( press(cur+'B') == 1 ) cur+='B' ;
else if ( press(cur+'X') == 1 ) cur+='X' ;
else cur+='Y' ;
while(siz<n) cur = call(cur) ;
return cur ;
}