제출 #583089

#제출 시각아이디문제언어결과실행 시간메모리
583089Mystic03콤보 (IOI18_combo)C++17
10 / 100
59 ms532 KiB
#include "combo.h"
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
std::string guess_sequence(int N) {
	string p = "";
	char c;
	vector<char> possible{ 'A', 'B', 'X', 'Y' };
	if (press("A")) {
		p.push_back('A');
		possible.erase(possible.begin() + 0);
	}
	else if (press("B")) {
		p.push_back('B');
		possible.erase(possible.begin() + 1);
	}
	else if (press("X")) {
		p.push_back('X');
		possible.erase(possible.begin() + 2);
	}
	else{
		p.push_back('Y');
		possible.erase(possible.begin() + 3);
	}
	for (int i = 1; i < N; i++) {
		for (char c : possible) {
			p.push_back(c);
			if (press(p) > i) break;
			p.pop_back();
		}
	}
	return p;

}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:7: warning: unused variable 'c' [-Wunused-variable]
    9 |  char c;
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...