제출 #482521

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

string guess_sequence(int N){
	char init;
	if(press("AB") == 1){
		if(press("A") == 1) init = 'A';
		else init = 'B';
	}
	else{
		if(press("X") == 1) init = 'X';
		else init = 'Y';
	}
	
	string s(N * 4, init);
	vector<char> v;
	if(init != 'A') v.push_back('A');
	if(init != 'B') v.push_back('B');
	if(init != 'X') v.push_back('X');
	if(init != 'Y') v.push_back('Y');
	
	for(int i = 1; i < N - 1; i++){
		s[i] = v[0];
		s[N + i] = v[0];
		s[N * 2 + i] = v[0];
		s[N * 3 + i] = v[1];
		
		s[i + 1] = v[0];
		s[N + i + 1] = v[1];
		s[N * 2 + i + 1] = v[2];
		
		int ret = press(s);
		int c;
		if(ret == i + 1) c = 0;
		else if(ret == i) c = 1;
		else c = 2;
		
		for(int j = 0; j < 4; j++) s[N * j + i] = v[c];
	}
	int c2;
	s[N * 2 - 1] = s[N * 3 - 1] = s[N * 4 - 1] = init;
	s[N - 1] = v[0];
	if(press(s) == N) c2 = 0;
	else{
		s[N - 1] = v[1];
		if(press(s) == N) c2 = 1;
		else c2 = 2;
	}
	s[N - 1] = c2;
	string ans(N, init);
	for(int i = 0; i < N; i++) ans[i] = s[i];
	return ans;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:5: error: 'press' was not declared in this scope
    6 |  if(press("AB") == 1){
      |     ^~~~~
combo.cpp:32:13: error: 'press' was not declared in this scope
   32 |   int ret = press(s);
      |             ^~~~~
combo.cpp:43:5: error: 'press' was not declared in this scope
   43 |  if(press(s) == N) c2 = 0;
      |     ^~~~~