# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
483011 | Spade1 | Combo (IOI18_combo) | C++14 | 36 ms | 640 KiB |
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 ll long long
#define pii pair<int, int>
#define st first
#define nd second
#define pb push_back
using namespace std;
string guess_sequence(int N) {
char first;
if (press("AB")) {
if (press("A")) first = 'A';
else first = 'B';
}
else {
if (press("X")) first = 'X';
else first = 'Y';
}
if(N == 1){
string tmp(1, first);
return tmp;
}
string ans(N, first);
string s(4*N, first);
vector<char> rem;
if (first != 'A') rem.pb('A');
if (first != 'B') rem.pb('B');
if (first != 'X') rem.pb('X');
if (first != 'Y') rem.pb('Y');
for (int i = 1; i < N - 1; ++i) {
s[i] = rem[0];
s[N + i] = rem[0];
s[2*N + i] = rem[0];
s[3*N + i] = rem[1];
s[i + 1] = rem[0];
s[N + i + 1] = rem[1];
s[2*N + i + 1] = rem[2];
int ret = press(s), c;
if (ret == i) c = 2;
if (ret == i + 1) c = 1;
if (ret == i + 2) c = 0;
s[i] = rem[c];
s[N + i] = rem[c];
s[2*N + i] = rem[c];
s[3*N + i] = rem[c];
ans[i] = rem[c];
}
ans[N - 1] = rem[0];
if (press(ans) == N) return ans;
ans[N - 1] = rem[1];
if (press(ans) == N) return ans;
ans[N - 1] = rem[2];
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |