이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
string s = "";
string A = "ABXY";
for (int i = 0; i < 3; i++) {
string k = "";
k += A[i];
if (press(k) == 1) {
s = s + A[i];
break;
}
}
if (s == "") {
s = "Y";
}
string a = "";
for (char c : A) {
if (s[0] != c) a = a + c;
}
bool ok = false;
int coins = 1, maxcoins = 1;
while (maxcoins < N){
coins = maxcoins;
for (int i = 0; i < 2; i++) {
if (!ok) {
if (press(s + a[i]) > coins) {
maxcoins ++;
s = s + a[i];
ok = true;
}
}
}
if (!ok) {
s = s + a[2];
maxcoins ++;
}
ok = false;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |