제출 #1192701

#제출 시각아이디문제언어결과실행 시간메모리
1192701stdfloat콤보 (IOI18_combo)C++20
100 / 100
8 ms520 KiB
#include <bits/stdc++.h>
#include "combo.h"
// #include "grader.cpp"
using namespace std;

string guess_sequence(int n) {
	string s = "AB";
	if (press(s)) {
		s = "A";
		if (!press(s)) s = "B";
	}
	else {
		s = "X";
		if (!press(s)) s = "Y";
	}

	vector<string> v = {"A", "B", "X", "Y"};
	for (int i = 0; i < 4; i++) {
		if (s == v[i]) {
			v.erase(v.begin() + i);
			break;
		}
	}

	if (n == 1) return s;

	for (int i = 1; i < n - 1; i++) {
		string t = s + v[1];
		for (auto j : v)
			t += s + v[2] + j;

		s += v[press(t) - i];
	}

	for (auto i : v) {
		s += i;

		if (i == v.back() || press(s) == n) return s;

		s.pop_back();
	}
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
   42 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...