Submission #788197

#TimeUsernameProblemLanguageResultExecution timeMemory
788197APROHACKCombo (IOI18_combo)C++17
0 / 100
1 ms292 KiB
#include <bits/stdc++.h>
#include "combo.h"
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

std::string guess_sequence(int N) {
  string p = "";
  string posi = "ABXY";
  string ans = "";
  string newPosi = "";
  int best = 0, res = 0;
  for(int j = 0 ; j < 3 ; j ++){
	  p = ans;
	  p+= posi[j];
	  int coin = press(p);
	  if(coin > res){
		  res = coin;
		  best = j;
	  }
  }
  if(res == 0)best = 3;
  ans += posi[best];	
  for(auto i : posi)if(i != posi[best])newPosi += i;
  //for (auto i : newPosi)cout << i << endl;
  for(int i = 1 ; i < N-1 ; i ++){
	  best = 0, res = 0;
	  p = ans;
	  p+=newPosi[0];
	  for(int j = 0 ; j < 3 ; j ++){
		  p += ans;
		  p += newPosi[1];
		  p += newPosi[j];
	  }
	  int coin = press(p);
	  //cout << " got " << coin << endl;
	  if(coin == i){
		  ans += newPosi[2];
	  }else if(coin == i+1){
		  ans += newPosi[0];
	  }else{
		  ans += newPosi[1];
	  }
  }
  p = ans;
  p += newPosi[0];
  if(press(p) == N){
	  ans += newPosi[0];
	  return ans ;
  }
  p = ans;
  p += newPosi[1];
  if(press(p) == N){
	  ans += newPosi[1];
	  return ans;
  }
  //cout << ans << endl;
  return ans ;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...