제출 #1014443

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

string guess_sequence(int N){
	string p="";
	vector<string> ch;
	if(press("AB")>0){
		if(press("A")==1) p="A",ch={"B","X","Y"};
		else p="B",ch={"A","X","Y"};
	}else{
		if(press("X")==1) p="X",ch={"A","B","X"};
		else p="Y",ch={"A","B","X"};;
	}
	if(N==1) return p;
	for(ll i=0;i<N-2;++i){
		string nstr=p+ch[0]+ch[0]+p+ch[0]+ch[1]+p+ch[0]+ch[2]+p+ch[1];
		ll k=press(nstr);
		if(k==p.size()+1){
			p+=ch[1];
		}else if(k==p.size()+2){
			p+=to_string(p[0]);
		}else{
			p+=ch[2]
		}
	}
	if(press(p+ch[0]+p+ch[1])==n){
		if(press(p+ch[0])==n) return p+ch[0];
		else return p+ch[1];
	}else{
		return p+ch[2];
	}
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:6: error: 'll' was not declared in this scope
   16 |  for(ll i=0;i<N-2;++i){
      |      ^~
combo.cpp:16:13: error: 'i' was not declared in this scope
   16 |  for(ll i=0;i<N-2;++i){
      |             ^
combo.cpp:18:5: error: expected ';' before 'k'
   18 |   ll k=press(nstr);
      |     ^~
      |     ;
combo.cpp:19:6: error: 'k' was not declared in this scope
   19 |   if(k==p.size()+1){
      |      ^
combo.cpp:24:12: error: expected ';' before '}' token
   24 |    p+=ch[2]
      |            ^
      |            ;
   25 |   }
      |   ~         
combo.cpp:27:29: error: 'n' was not declared in this scope
   27 |  if(press(p+ch[0]+p+ch[1])==n){
      |                             ^