Submission #916747

#TimeUsernameProblemLanguageResultExecution timeMemory
916747_VIBECombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include "combo.h"
#include <string>
#include<bits/stdc++.h>
using namespace std;

string guess_sequence(int N);
 
int press(string p);
 
string guess_sequence(int N) {
 	
  	set<char> s={'A','X','B','Y'};
  	string ans;
  	
  	for(auto x:s){
      	string q;
      	q+=x;
      	if(press(q)==1){
          	s.erase(x);
          	ans=q;break;
        }
    }
  
  	if(s.size()==4){
      	ans=*s.rbegin();
      	s.erase(*s.rbegin());
    }
  
  	vector<char> v={s.begin(),s.end()};
  	
  	for(int i=1;i<N;i++){
      	
      	string q;
      	for(int j=0;j<3;j++) q+=ans+to_string(v[0])+to_string(v[j]);
      	
      	q+=ans+to_string(v[1]);
      	int res=press(q);
      	
      	if(res==ans.size()){
          	ans+=v[2];
        }
      	else if(res==ans.size()+2){
            ans+=v[0];
        }
      	else ans+=v[1];
    
    }
  
  	return ans;
  	
  
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |        if(res==ans.size()){
      |           ~~~^~~~~~~~~~~~
combo.cpp:42:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |        else if(res==ans.size()+2){
      |                ~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...