Submission #718746

#TimeUsernameProblemLanguageResultExecution timeMemory
718746chimeneCombo (IOI18_combo)C++17
100 / 100
30 ms564 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N){ char lettres[4]={'A','B','X','Y'}; vector<int> indices; int prem,longueur; string mot="",deb=""; indices.clear(); mot+=lettres[0]; mot+=lettres[1]; if (press(mot)>=1){ mot.pop_back(); if (press(mot)==1){ prem=0; } else{ prem=1; } } else { mot.clear(); mot+=lettres[2]; if (press(mot)==1){ prem=2; } else{ prem=3; } } for (int i=0;i<4;i++){ if (i==prem){ deb+=lettres[i]; } else{ indices.push_back(i); } } for (int i=2;i<N;i++){ mot.clear(); mot+=deb; mot+=lettres[indices[0]]; for (int j=0;j<3;j++){ mot+=deb; mot+=lettres[indices[1]]; mot+=lettres[indices[j]]; } longueur=press(mot); if (longueur==i){ deb+=lettres[indices[0]]; } else if (longueur==i+1){ deb+=lettres[indices[1]]; } else{ deb+=lettres[indices[2]]; } } if (N>1){ mot.clear(); mot+=deb; mot+=lettres[indices[0]]; if (press(mot)==N){ deb+=lettres[indices[0]]; } else { mot.pop_back(); mot+=lettres[indices[1]]; if (press(mot)==N){ deb+=lettres[indices[1]]; } else{ deb+=lettres[indices[2]]; } } } return deb; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...