| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1305867 | farica | Combo (IOI18_combo) | C++20 | 1 ms | 412 KiB |
#include "combo.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using vi = vector<int>;
using pi = pair<int,int>;
string guess_sequence(int N) {
string ans = "";
int prev = 1, tmp = press("A");
if(tmp) ans = "A";
else if(press("B")) ans = "B";
else if(press("X")) ans = "X";
vector<char>c({'A', 'B', 'X', 'Y'});
for(int i=0; i<4; ++i) {
if(c[i] == ans[0]) {
c.erase(c.begin()+i);
break;
}
}
for(int i=1; i<N-1; ++i) {
string nw = ans + c[0] + c[0] + ans + c[0] + c[1] + ans + c[0] + c[2] + ans + c[1];
tmp = press(nw);
int len = (int)ans.length();
if(tmp == len+1) ans += c[1];
else if(tmp == len+2) ans += c[0];
else ans += c[2];
}
for(char ch: c) {
if(press(ans+ch) == N) {
ans += ch;
return ans;
}
}
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
