# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
346441 | lebasivillar | 콤보 (IOI18_combo) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include "combo.h"
using namespace std;
string guess_sequence(int N){
string t;
if (press("AB")>0){
if (press("A")>0){
t.push_back('A');
}
else{
t.push_back('B');
}
}
else{
if(press("X")>0){
t.push_back('X');
}
else{
t.push_back('Y');
}
}
if (N==1){
return t;
}
string sequence = "ABXY";
vector <string> left;
for (in i = 0; i<sequence.size(); i++){
if(sequence[i] != t[0]){
string word;
word.push_back(sequence.size[i]);
left.push_back(word);
}
}
vector <string> ends = {left[i], left[2] + left[0], left[2] + left[1], left[2]};
while (t.size()< N-1){
int value = press(t+ends[0]+t+ends[1]+t+ends[2]+t+ends[3])-t.size();
if (value==0){
t += left[0];
}
if (value==1){
t += left[1];
}
if (value==2){
t += left[2];
}
}
if (press(t+left[0])==N){
t += left[0];
}
else if (press(t+left[1])==N){
t += left[1];
}
else{
t += left[2];
}
return t;
}