Submission #850038

#TimeUsernameProblemLanguageResultExecution timeMemory
850038Andrijanikolic73Combo (IOI18_combo)C++17
30 / 100
29 ms1712 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; //#include "combo.h" int pitao; /* int press(string P){ cout<<"? "<<P; cout<<endl; int x; cin>>x; return x; }*/ std::string guess_sequence(int N) { /* if(N==3){ string pref=""; char P[4]={'A','B','X','Y'}; for(int i=0;i<N;i++){ for(int j=0;j<4;j++){ if(press(pref+P[j])==i+1){ pref+=P[j]; break; } } } return pref; }*/ string pref=""; char P[4]={'A','B','X','Y'}; for(int i=0;i<3;i++){ if(press(pref+P[i])){ pref+=P[i]; pitao++; break; } } if(!pref.size())pref+=P[3]; int visited[4]; for(int i=0;i<4;i++)visited[i]=0; for(int i=0;i<4;i++){ if(P[i]==pref[0])visited[i]=1; } for(int i=1;i<N;i++){ vector<char>probaj; for(int j=0;j<4;j++)if(!visited[j])probaj.push_back(P[j]); string guess=pref; guess+=probaj[0]; guess+=pref; guess+=probaj[1]; pitao++; if(press(guess)==i+1){ // il prvi il drugi if(press(pref+probaj[0])==i+1)pref+=probaj[0]; else pref+=probaj[1]; pitao++; } else { // treci pref+=probaj[2]; } } return pref; }/* int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; cout<<guess_sequence(n); }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...