제출 #601258

#제출 시각아이디문제언어결과실행 시간메모리
601258Fidan콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
vector<char> v(3);
string guess_sequence(int N) {
	
	ll k1=press("AB");
	if(k1==1){
		v[1]='X', v[2]='Y';
		ll k2=press("A");
		if(k2==1){
			v[0]='B';
			s="A";
		}
		else{
			v[0]='A';
			s="B";
		}
	}
	else{
		v[0]='A', v[1]='B';
		ll k2=press("X");
		if(k2==1){
			v[2]='Y';
			s="X";
		}
		else{
			v[2]='X';
			s="Y";
		}
	}
	
	ll l=1, a;
	while(l<N){
		l++;
		
		s+=v[0];
		a=press(s);
		if(a==l) continue;
		s.pop_back();
		
		s+=v[1];
		a=press(s);
		if(a==l) continue;
		s.pop_back();
		
		s+=v[2];
	}
	
	return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:4: error: 's' was not declared in this scope
   14 |    s="A";
      |    ^
combo.cpp:18:4: error: 's' was not declared in this scope
   18 |    s="B";
      |    ^
combo.cpp:26:4: error: 's' was not declared in this scope
   26 |    s="X";
      |    ^
combo.cpp:30:4: error: 's' was not declared in this scope
   30 |    s="Y";
      |    ^
combo.cpp:38:3: error: 's' was not declared in this scope
   38 |   s+=v[0];
      |   ^
combo.cpp:51:9: error: 's' was not declared in this scope
   51 |  return s;
      |         ^