제출 #140772

#제출 시각아이디문제언어결과실행 시간메모리
140772caoash콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef pair<int, pi> pii;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define fax(i, a) for (int i = 0; i < (a); i++)
#define f0x(i, a, b) for (int i = (a); i < (b); i++)
#define faxd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define f0xd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define memeset memset

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

string guess_sequence(int n){
	string soFar;
	string first = "A";
	if(press("B")){
		first = "B";
	}
	else if(press("Y")){
		first = "Y";
	}
	else if(press("X")){
		first = "X";
	}
	soFar += first;
	string c1,c2,c3;
	if(first == "A"){
		c1 = "X"; c2 = "Y"; c3 = "B";
	}
	else if(first == "B"){
		c1 = "X"; c2 = "Y"; c3 = "A";
	}
	else if(first == "X"){
		c1 = "B"; c2 = "Y"; c3 = "A";
	}
	else if(first == "Y"){
		c1 = "X"; c2 = "B"; c3 = "A";
	}
	for(int i = 0; i < n-1; i++){
		int val = press(soFar + c1 + c1 + soFar + c2);
		if(val == sz(soFar)){
			soFar += c3;
		}
		else if(val == sz(soFar)+1){
			soFar += c2;
		}
		else{
			soFar += c1;
		}
	}
	return soFar;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:53:5: error: 'press' was not declared in this scope
   53 |  if(press("B")){
      |     ^~~~~
combo.cpp:77:13: error: 'press' was not declared in this scope
   77 |   int val = press(soFar + c1 + c1 + soFar + c2);
      |             ^~~~~