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"
#define endl '\n'
#define modulo 200003
#define PI acos(-1)
#pragma GCC target ("avx2")
#pragma GCC optimize("trapv")
//#define int long long
#define sinDegrees(x) sin((x) * PI / 180.0)
#define cosDegrees(x) cos((x) * PI / 180.0)
#define tanDegrees(x) tan((x) * PI / 180.0)
#define atanDegrees(x) atan(x)* 180.0 / PI
using namespace std;
int power(int x,int y,int m)
{
if(y<0)
return 0;
int temp;
if(y == 0)
return 1;
temp = (power(x, y/2,m))%m;
if (y%2 == 0)
return ((temp%m)*temp);
else
return ((x*temp%m)*temp%m)%m;
}
int inv(int x)
{
return (power(x,modulo-2,modulo))%modulo;
}
bool comp(int a,int b)
{
return a>b;
}
///solution created by: Ahmadsm2005
string guess_sequence(int n){
vector<char>lolz;
lolz.push_back('A'),lolz.push_back('B'),lolz.push_back('X'),lolz.push_back('Y');
n--;
char S;
string answer;
bool counter=0;
if(press("AB")){
if(press("A"))
S='A';
else
S='B';
}
else
if(press("X"))
S='X';
else
S='Y';
for(int i=0;i<4;i++)
if(lolz[i]==S){
lolz.erase(lolz.begin()+i);
break;
}
answer+=S;
while(n--){
if(n){
string SS=answer,SS2=answer,SS3=answer,SS4=answer;
SS+=lolz[0]+lolz[0],SS2+=lolz[0]+lolz[1],SS3+=lolz[0]+lolz[2],SS4+=lolz[1];
string combined=S+SS+S+SS2+S+SS3+S+SS4;
if(press(combined)==answer.size())
answer+=lolz[2];
else if(press(combined)==answer.size()+1)
answer+=lolz[1];
else
answer+=lolz[0];
}
else
if(press(answer+lolz[0])==answer.size()+1)
answer+=lolz[0];
else if(press(answer+lolz[1])==answer.size()+1)
answer+=lolz[1];
else
answer+=lolz[2];
}
return answer;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:65:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
65 | if(press(combined)==answer.size())
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:67:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
67 | else if(press(combined)==answer.size()+1)
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:73:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
73 | if(press(answer+lolz[0])==answer.size()+1)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:75:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
75 | else if(press(answer+lolz[1])==answer.size()+1)
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:42:6: warning: unused variable 'counter' [-Wunused-variable]
42 | bool counter=0;
| ^~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |