제출 #737798

#제출 시각아이디문제언어결과실행 시간메모리
737798Elvin_Fritl콤보 (IOI18_combo)C++17
100 / 100
45 ms712 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int n) { string s; vector<char>v; int toto=press("AB"),toto2=press("AX"),k=1; if(toto==1 && toto2==1){ s+='A'; v.push_back('B'); v.push_back('Y'); v.push_back('X'); } else if(toto==0 && toto2==0){ s+='Y'; v.push_back('B'); v.push_back('A'); v.push_back('X'); } else if(toto==2){ s+="AB"; k=2; v.push_back('B'); v.push_back('Y'); v.push_back('X'); } else if(toto2==2){ s+="AX"; k=2; v.push_back('B'); v.push_back('Y'); v.push_back('X'); } else if(toto==1){ s+='B'; v.push_back('A'); v.push_back('Y'); v.push_back('X'); } else{ s+='X'; v.push_back('B'); v.push_back('Y'); v.push_back('A'); } if(k==n){ return s; } for(int i=k;i<n-1;i++){ string s1=s+v[0],s20=s+v[1]+v[0],s21=s+v[1]+v[1],s22=s+v[1]+v[2]; toto=press(s1+s20+s21+s22); if(toto == i+2){ s+=v[1]; } else if(toto == i+1){ s+=v[0]; } else{ s+=v[2]; } } if(press(s+v[0])==n){ return s+v[0]; } if(press(s+v[1])==n){ return s+v[1]; } return s+v[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...