제출 #369140

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

using namespace std;

string string_guess(int N){
	string ans;
	vector<string> s = {"A", "B", "X", "Y"};
	bool f = false;
	for(int i = 0; i < 3 && !f; i++){
		if(press(s[i]) == 1){
			ans += s[i];
			s.erase(s.begin() + i);
			f = true;
		}
	}
	if(!f){
		ans += 'Y';
		s.erase(s.begin() + 3);
	}
	for(int i = 1; i < N-1; i++){
		string query = ans + s[0] + ans + s[1] + s[0] + ans + s[1] + s[1] + ans + s[1] + s[2];
		int r = press(query);
		if(r == ans.size() + 1){
			ans += s[0];
			continue;
		}
		if(r == ans.size() + 2){
			ans += s[1];
			continue;
		}
		if(r == ans.size()){
			ans += s[2];
			continue;
		}
	}
	f = false;
	for(int i = 0; i < 2 && !f; i++){
		if(press(ans + s[i]) == N){
			ans += s[i];
			f = true;
		}
	}
	if(!f){
		ans += s[2];
	}
	return ans;
}

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

combo.cpp: In function 'std::string string_guess(int)':
combo.cpp:10:6: error: 'press' was not declared in this scope
   10 |   if(press(s[i]) == 1){
      |      ^~~~~
combo.cpp:22:11: error: 'press' was not declared in this scope
   22 |   int r = press(query);
      |           ^~~~~
combo.cpp:23:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   if(r == ans.size() + 1){
      |      ~~^~~~~~~~~~~~~~~~~
combo.cpp:27:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   if(r == ans.size() + 2){
      |      ~~^~~~~~~~~~~~~~~~~
combo.cpp:31:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   if(r == ans.size()){
      |      ~~^~~~~~~~~~~~~
combo.cpp:38:6: error: 'press' was not declared in this scope
   38 |   if(press(ans + s[i]) == N){
      |      ^~~~~