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>
using namespace std;
string guess_sequence(int n){
string cur = "";
vector<string> c = {"A", "B", "X", "Y"};
if(press(c[0]+c[1]))
if(press(c[0])) cur = c[0];
else cur = c[1], swap(c[0], c[1]);
else if(press(c[2])) cur = c[2], swap(c[0], c[2]);
else cur = c[3], swap(c[3], c[0]);
if(n==1) return cur;
for(int i = 2; i<=n-1; ++i){
int res = press(cur+c[1]+cur+c[2]+c[1]+cur+c[2]+c[2]+cur+c[2]+c[3]);
if(res==cur.size()+1) cur += c[1];
else if(res==cur.size()+2) cur += c[2];
else cur += c[3];
}
if(press(cur+c[1])==n) cur += c[1];
else if(press(cur+c[2])==n) cur += c[2];
else cur += c[3];
return cur;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:15: 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(res==cur.size()+1) cur += c[1];
| ~~~^~~~~~~~~~~~~~
combo.cpp:17:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | else if(res==cur.size()+2) cur += c[2];
| ~~~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |