제출 #732201

#제출 시각아이디문제언어결과실행 시간메모리
732201baneCombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <string>
#include<vector>
using namespace std;
int press(std::string p);

string guess_sequence(int N){
	string ans = "";
	int old = 0;
	vector<string>choices = {"A", "B", "X", "Y"};
	for (int i = 0;  i < N; i++){
		for (int j = 0; j < 4; j++){
			if (press(ans + choices[j]) > old){
				ans += choices[j];
				++old;
				break;
			}
		}
	}
	assert(ans.size() == N);
	return ans;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:19:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |  assert(ans.size() == N);
      |         ~~~~~~~~~~~^~~~
combo.cpp:19:2: error: 'assert' was not declared in this scope
   19 |  assert(ans.size() == N);
      |  ^~~~~~
combo.cpp:3:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    2 | #include<vector>
  +++ |+#include <cassert>
    3 | using namespace std;