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 "grader.cpp"
#include "combo.h"
#include <bits/stdc++.h>
#define sc second
#define fr first
#define mk make_pair
#define pb push_back
using namespace std;
const int NN = (1e6 + 5);
const int inf = (1e9 + 7);
string a,s,t;
int f;
string guess_sequence(int n) {
if (press("A") > 0) f = 1,a += "A";
else if (press("B") > 0) f = 2,a += "B";
else if (press("X") > 0) f = 3,a += "X";
else f = 4,a += "Y";
if (f != 1) s += "A";
if (f != 2) s += "B";
if (f != 3) s += "X";
if (f != 4) s += "Y";
for (int i = 2; i < n; i ++) {
string cur = a;
t = "";
t += cur + s[0];
t += cur + s[1] + s[0];
t += cur + s[1] + s[1];
t += cur + s[1] + s[2];
if (press(t) == i) {
a += s[0];
continue;
}
else if (press(t) == i + 1) {
a += s[1];
continue;
}
else {
a += s[2];
continue;
}
}
if (press(a + s[0]) == n) return (a + s[0]);
if (press(a + s[1]) == n) return (a + s[1]);
if (press(a + s[2]) == n) return (a + s[2]);
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
55 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |