Submission #318396

# Submission time Handle Problem Language Result Execution time Memory
318396 2020-11-01T18:12:19 Z soroush Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "combo.h"
 
using namespace std;
 
string guess_sequence(int n){
	string ans = "";
	string f = "A";
	if(press(ans + "B") == 1)	
		f = "B";
	else if(press(ans + "X") == 1)	
		f = "X";
	else if(press(ans + "Y") == 1)	
		f = "Y";
	ans += f;
	vector < string > v ,  vec = {"A" , "B" , "X" , "Y"};
	for(int i = 0 ; i < 4 ; i ++){
		auto s = vec.back();
		vec.pop_back();
		if(s!=f)
			v.pb(s);
	}
	for(int i = 1 ; i < n ; i ++){
		int res = press(ans + vec[0] + ans + vec[1] + vec[0] + ans + vec[1] + vec[1] + ans + vec[1] + vec[2]);
		if(res == i)
			ans += vec[2];
		if(res == i + 1)
			ans += vec[0];
		if(res == i + 2)
			ans += vec[1];
	}
	return(ans);
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:6: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'pb'
   21 |    v.pb(s);
      |      ^~