제출 #99111

#제출 시각아이디문제언어결과실행 시간메모리
99111JustasLeCombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
// #include "combo.h";
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int N) {
	set<char> X = {'A', 'B', 'X', 'Y'};
	string s = "";
	for (auto it = X.begin(); it != X.end(); it++) {
		int x = press(s + *it);
		if (x != 0) {
			s += *it;
			X.erase(*it);
			break; 
		}
	}
	if (s == "") {
		return s;
	}
	string Y = "";
	for (auto it = X.begin(); it != X.end(); it++) {
		Y += *it;
	}
	int prev = 1;
	bool ok = true;
	while (ok) {
		ok = false;
		int x;
		set<int> W;
		while ((int) W.size() != 3) {
			int rn = rand() % 3;
			if (!W.count(rn)) {
				x = press(s + Y[rn]);
				if (x > rn) {
					s += Y[rn];
					break;
				}
				W.insert(rn);	
			}
		}
		if ((int) s.size() == N) {
			break;
		}
	}
	return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:11: error: 'press' was not declared in this scope
   10 |   int x = press(s + *it);
      |           ^~~~~
combo.cpp:33:9: error: 'press' was not declared in this scope
   33 |     x = press(s + Y[rn]);
      |         ^~~~~
combo.cpp:24:6: warning: unused variable 'prev' [-Wunused-variable]
   24 |  int prev = 1;
      |      ^~~~