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>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2,fma")
using namespace std;
string a,b,c,d;
#define p press
string guess_sequence(int N) {
a ="A",b = "B", c = "X", d = "Y";
if(N==1) return p(a)?a:p(b)?b:p(c)?c:d;
string k; k.reserve(2100);
int f = p(a+b);
if(f) k += p(a) ? (swap(a,d),d) : (swap(b,d),d); else k += p(c) ? (swap(c,d),d) : d;
const string ba=b+a,bb=b+b,bc=b+c;
for(int i=0;i<N-2;i++) k+= (f=p(k+a+k+ba+k+bb+k+bc), f==(k.size()+2)) ? b : (f==(k.size()+1) ? a : c);
if(p(k+a)>(k.size()))k+=a;else if(p(k+b)>(k.size()))k+=b;else k+=c;
return k;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:56: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i=0;i<N-2;i++) k+= (f=p(k+a+k+ba+k+bb+k+bc), f==(k.size()+2)) ? b : (f==(k.size()+1) ? a : c);
| ~^~~~~~~~~~~~~~
combo.cpp:15:80: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for(int i=0;i<N-2;i++) k+= (f=p(k+a+k+ba+k+bb+k+bc), f==(k.size()+2)) ? b : (f==(k.size()+1) ? a : c);
| ~^~~~~~~~~~~~~~
combo.cpp:16:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | if(p(k+a)>(k.size()))k+=a;else if(p(k+b)>(k.size()))k+=b;else k+=c;
| ^
combo.cpp:16:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | if(p(k+a)>(k.size()))k+=a;else if(p(k+b)>(k.size()))k+=b;else k+=c;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |