제출 #320713

#제출 시각아이디문제언어결과실행 시간메모리
320713NicolaAbusaad2014콤보 (IOI18_combo)C++14
100 / 100
72 ms16484 KiB
/** * Prof.Nicola **/ #include "combo.h" #include <bits/stdc++.h> using namespace std; vector<string>v; long n; string ans; void solve(long x) { string t; long z; if(x<n-1){ t=ans; t+=v[0]; t+=v[0]; t+=ans; t+=v[0]; t+=v[1]; t+=ans; t+=v[0]; t+=v[2]; t+=ans; t+=v[1]; z=press(t); z-=x; ans+=v[2-z]; solve(x+1); } else{ t=ans+v[0]; if(press(t)-x){ ans+=v[0]; } else{ t=ans+v[1]; if(press(t)-x){ ans+=v[1]; } else{ ans+=v[2]; } } return; } } void rem(string s) { for(long i=0;i<4;i++){ if(v[i]==s){ v.erase(v.begin()+i); return; } } } std::string guess_sequence(int N) { n=N; v.push_back("A"); v.push_back("B"); v.push_back("X"); v.push_back("Y"); if(N==1){ string s="A"; if(press(s)){ return s; } s="B"; if(press(s)){ return s; } s="X"; if(press(s)){ return s; } s="Y"; return s; } else{ string s="AB"; long x; x=press(s); if(x>0){ s="A"; if(press(s)){ ans+="A"; } else{ ans+="B"; } } else{ s="X"; if(press(s)){ ans+="X"; } else{ ans+="Y"; } } rem(ans); solve(1); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...