제출 #301646

#제출 시각아이디문제언어결과실행 시간메모리
301646Dovran콤보 (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"

#define N 100009
#define pii pair <int, int>
#define ff first
#define sz() size()
#define ss second
#define pb push_back
#define ll long long

using namespace std;

char c[5]={'X', 'Y', 'A', 'B'};

string guess_sequence(int n){
	string s+='X';
	int in=-1;
	for(int i=0; i<3; i++){
		s[0]=c[i];
		int x=press(s);
		if(x){
			in=i;
			break;
		}
	}
	if(in<0)
		in=3;
	s[0]=c[in];
	swap(c[in], c[3]);
	for(int i=1; i<n; i++){
		s+='X';
		in=0;
		for(int j=0; j<2; j++){
			s[i]=c[j];
			int x=press(s);
			if(x==i){
				in=1;
				break;
			}
		}
		if(!in)
			s[i]=c[2];
	}
	return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:10: error: expected initializer before '+=' token
   17 |  string s+='X';
      |          ^~
combo.cpp:20:3: error: 's' was not declared in this scope
   20 |   s[0]=c[i];
      |   ^
combo.cpp:29:2: error: 's' was not declared in this scope
   29 |  s[0]=c[in];
      |  ^