Submission #800604

#TimeUsernameProblemLanguageResultExecution timeMemory
800604iskhakkutbilimCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define all(a) a.begin(), a.end()



string guess_sequence(int N){
	string ans = "";
	char chars[4] = {'A', 'B', 'X', 'Y'};
	if(press("A") == 1){
		ans.push_back('A');
	}else if(press("B") == 1){
		ans.push_back('B');
	}else if(press("X") == 1){
		ans.push_back('X');
	}else{
		ans.push_back('Y');
	}
	set<char> chars;
	chars.insert('A');
	chars.insert('B');
	chars.insert('X');
	chars.insert('Y');
	st.erase(ans[0]);
	
	for(int i = 2;i <= N; i++){
		for(char ch : chars){
			if(press(ans+ch) == i){
				ans.push_back(ch);
				break;
			}
		}
	}
	if((int)ans.size() != N) assert(false);
	return ans;
}



Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:5: error: 'press' was not declared in this scope
   13 |  if(press("A") == 1){
      |     ^~~~~
combo.cpp:22:12: error: conflicting declaration 'std::set<char> chars'
   22 |  set<char> chars;
      |            ^~~~~
combo.cpp:12:7: note: previous declaration as 'char chars [4]'
   12 |  char chars[4] = {'A', 'B', 'X', 'Y'};
      |       ^~~~~
combo.cpp:23:8: error: request for member 'insert' in 'chars', which is of non-class type 'char [4]'
   23 |  chars.insert('A');
      |        ^~~~~~
combo.cpp:24:8: error: request for member 'insert' in 'chars', which is of non-class type 'char [4]'
   24 |  chars.insert('B');
      |        ^~~~~~
combo.cpp:25:8: error: request for member 'insert' in 'chars', which is of non-class type 'char [4]'
   25 |  chars.insert('X');
      |        ^~~~~~
combo.cpp:26:8: error: request for member 'insert' in 'chars', which is of non-class type 'char [4]'
   26 |  chars.insert('Y');
      |        ^~~~~~
combo.cpp:27:2: error: 'st' was not declared in this scope; did you mean 'std'?
   27 |  st.erase(ans[0]);
      |  ^~
      |  std
combo.cpp:31:7: error: 'press' was not declared in this scope
   31 |    if(press(ans+ch) == i){
      |       ^~~~~