제출 #1293717

#제출 시각아이디문제언어결과실행 시간메모리
1293717scalifrastico_098콤보 (IOI18_combo)C++20
5 / 100
1 ms400 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string r="ABXY";
int guess_one(string s)
{
  int l=press(s+'A'+s+'B'), o=0; if(l<s.size()+1)o=2;
  l=press(s+r[o]); if(l<s.size()+1)o++; return o;
}
string guess_sequence(int n) {
  string p = ""; int y[4];
  for (int i = 0; i < 4; ++i) {
    y[i]=i;
  }
  int u=guess_one(p); p+=r[u]; swap(y[u], y[3]);
  for(int i=0; i<n-2; i++)
  {
    string s=""; for(int j=0; j<3; j++){s+=p; s+=r[y[0]]; s+=r[y[j]];}
    s+=p; s+=r[y[1]]; int l=press(s);
    if(l==p.size()+2){p+=r[y[0]];} else if(l==p.size()+1)p+=r[y[1]];
    else{p+=r[y[2]];}
  } 
  int k=guess_one(p); p+=r[k];
  return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...