Submission #718745

#TimeUsernameProblemLanguageResultExecution timeMemory
718745chimeneCombo (IOI18_combo)C++17
0 / 100
1 ms208 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.erase(1,1); if (press(mot)==1){ prem=0; } else{ prem=1; } } else { mot.erase(0,2); 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[0]; if (press(mot)==N){ deb+=lettres[0]; } else { mot.erase(N-1,1); mot+=lettres[1]; if (press(mot)==N){ deb+=lettres[1]; } else{ deb+=lettres[2]; } } } return deb; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...