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;
#define db long double
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define endl '\n'
#define all(x) x.begin(), x.end()
#define fastio\
ios_base::sync_with_stdio(0);\
cin.tie(0);\
cout.tie(0)\
string guess_sequence(int n) {
srand(time(0));
string res = "";
set<string> st = {"A", "B", "X", "Y"};
for(string s : {"A", "B", "X", "Y"}){
if(press(s)){
res = s;
st.erase(s);
break;
}
}
for(int i = 2; i <= n; i++){
while(true){
int ind = rand() % 3;
auto it = st.begin();
while(ind--) it++;
if(press(res + *it) == res.size() + 1){
res += *it;
break;
}
}
}
return res;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | if(press(res + *it) == res.size() + 1){
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |