Submission #574977

#TimeUsernameProblemLanguageResultExecution timeMemory
574977HackapieCombo (IOI18_combo)C++17
91 / 100
41 ms476 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N){ set<char> s; s.insert('A'); s.insert('B'); s.insert('X'); s.insert('Y'); string res; string check; for(int i=1;i<=N;i++){ //cout<<"i:"<<i<<"\n"; //each i for ith character //in first i we have 4 choices //afterthat we have 3 choices always char c; if(i==1){ for(auto x:s){ string aux=res; aux+=x; int ans=press(aux); // cout<<aux<<"\n"; // int ans; // cin>>ans; if(ans==i){ //ok this is part of the string res=aux; c=x; break; } } if(i==1)s.erase(c); for(auto x:s)check+=x; // cout<<"pr.size():"<<pr.size()<<"\n"; // for(int i=0;i<pr.size();i++){ // cout<<pr[i]<<" "; // } cout<<"\n"; }else{ if(i==N){ for(auto x:s){ string aux=res; aux+=x; int ans=press(aux); // cout<<aux<<"\n"; // int ans; // cin>>ans; if(ans==i){ //ok this is part of the string res=aux; break; } } }else{ string ch=res+check[1]+res+check[2]+check[0]+res+check[2]+check[1]+res+check[2]+check[2]; res+=check[press(ch)-res.size()]; //we are not providing any res+check[0] in query so if 0th then always return 0 similarly we are provinging only next charcater for check[1] so if true always return 1 more and similarly we are providing all possibility of 2nd check so it will always return 2 more if present } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...