제출 #916900

#제출 시각아이디문제언어결과실행 시간메모리
916900_VIBECombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include<bits/stdc++.h>
 
 
 
std::string guess_sequence(int N) {
 	using namespace std;
  	s
  	//guesing the first character
  	// in three queries
  	
   set<char> s={'A','X','B','Y'};
    string ans;
  
    vector<int> v1={'A','X','B','Y'};
    
    string q;
    q=v1[0]+v1[1];
    
    
    if(press(q)==1){
        q=v1[0]+v1[2];
        if(press(q)==1) ans=v1[0];
        else ans=v1[1];
    }
    else{
        q=v1[3];
        if(press(q)==1) ans=v1[3];
        else ans=v1[4];
    }
    
 
    s.erase(ans[0]);
  
  	if(N==1) return ans;
  
  	vector<char> v={s.begin(),s.end()};
  	// ans contains prefix of my actual string
  	
  	for(int i=1;i<N-1;i++){
      	
      	string q;
      	//query at ith index(0 based)
      	//lets say remaining three characters x,b,y
		// then i query for ans+xx+ans+xb+ans+xy+ans+y
      	//if result==i then b appears
      	// if result==i+2 then x appears
      	// if result==i+1 then y appears      
      
      	for(int j=0;j<3;j++) q+=ans+v[0]+v[j];
      	
      	q+=ans+v[1];
      	int res=press(q);
      	
      	if(res==i) ans+=v[2];
      	else if(res==i+2) ans+=v[0];
      	else ans+=v[1];
    
    }
  	
  	for(int i=0;i<2;i++){
      	string q=ans+v[i];
      	if(press(q)==N) return q;
    }
  
  	ans+=v[2];
  	return ans;
  	
  
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:4: error: 's' was not declared in this scope
    8 |    s
      |    ^
combo.cpp:37:37: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<char>'
   37 |    vector<char> v={s.begin(),s.end()};
      |                                     ^
      |                                     |
      |                                     <brace-enclosed initializer list>