제출 #805686

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




char guess_first(){
	int ans = press("AB");
	if(ans==0){
		ans=press("X");
		if(ans==1){
			return 'X';
		}
		return 'Y';
	}	
	else{
		ans=press("A");
		if(ans==1){
			return 'A';
		}
		return 'B';
	}
}


string guess_sequence(int n){
	char f = guess_first();
	vector<char> nf;
	if('A'!=f)nf.pb('A');
	if('B'!=f)nf.pb('B');
	if('X'!=f)nf.pb('X');
	if('Y'!=f)nf.pb('Y');
	int gsd=1;
	string ans= "";
	ans+=f;
	if(n==1){
		return ans;
	}
	while(gsd<n-1){
		string gs=ans+nf[0]+nf[0]+ans+nf[0]+nf[1]+ans+nf[0]+nf[2]+ans+nf[1]+nf[0];
		int kita=press(gs);
		if(kita==gsd-1){
			ans.pop_back();
			ans+=nf[1];
			ans+=nf[0];
			gsd++;
		}
		else if(kita==gsd){
			gsd++;
			ans+=nf[2];
		}
		else if(kita==gsd+1){
			gsd++;
			ans+=nf[1];
		}
		else{
			gsd++;
			ans+=nf[0];
		}
	}
	string gs=ans+nf[0];
	if(press(gs)==n){
		return gs;
	}
	else{
		gs.pop_back();
		gs+=nf[1];
		if(press(gs)==n){
			return gs;
		}
		else{
			gs.pop_back();
			return gs+nf[2];
		}
	}
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:15: error: 'class std::vector<char>' has no member named 'pb'
   30 |  if('A'!=f)nf.pb('A');
      |               ^~
combo.cpp:31:15: error: 'class std::vector<char>' has no member named 'pb'
   31 |  if('B'!=f)nf.pb('B');
      |               ^~
combo.cpp:32:15: error: 'class std::vector<char>' has no member named 'pb'
   32 |  if('X'!=f)nf.pb('X');
      |               ^~
combo.cpp:33:15: error: 'class std::vector<char>' has no member named 'pb'
   33 |  if('Y'!=f)nf.pb('Y');
      |               ^~