제출 #100158

#제출 시각아이디문제언어결과실행 시간메모리
100158MvCCombo (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
string guess_sequence(int n)
{
	int x;
	string ans,p,t="ABXY",v;
	char ch;
	x=press("AB");
	if(x==1)
	{
		x=press("A");
		if(x==0)s+="B",ch='B';
		else s+="A",ch='A';
	}
	else if(x==2)s+="A",ch='A';
	else 
	{
		x=press("X");
		if(x==0)s+="Y",ch='Y';
		else s+="X",ch='X';
	}
	for(int i=0;i<4;i++)
	{
		if(t[i]==ch)
		{
			for(int j=0;j<i;j++)v+=t[j];
			for(int j=i+1;j<4;j++)v+=t[j];
			break;
		}
	}
	for(int i=2;i<n;i++)
	{
		p=ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2];
		x=press(p);
		if(x==(int)ans.size())ans+=v[2];
		else if(x==(int)ans.size()+1)ans+=v[0];
		else ans+=v[1];
	}
	x=press(ans+v[0]);
	if(x==n)ans+=v[0];
	else 
	{
		x=press(ans+v[1]);
		if(x==n)ans+=v[1];
		else ans+=v[2];
	}
	return ans;
}
/*int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	
    return 0;
}*/

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:4: error: 'press' was not declared in this scope
   23 |  x=press("AB");
      |    ^~~~~
combo.cpp:27:11: error: 's' was not declared in this scope
   27 |   if(x==0)s+="B",ch='B';
      |           ^
combo.cpp:28:8: error: 's' was not declared in this scope
   28 |   else s+="A",ch='A';
      |        ^
combo.cpp:30:15: error: 's' was not declared in this scope
   30 |  else if(x==2)s+="A",ch='A';
      |               ^
combo.cpp:34:11: error: 's' was not declared in this scope
   34 |   if(x==0)s+="Y",ch='Y';
      |           ^
combo.cpp:35:8: error: 's' was not declared in this scope
   35 |   else s+="X",ch='X';
      |        ^