제출 #468333

#제출 시각아이디문제언어결과실행 시간메모리
468333PiejanVDC콤보 (IOI18_combo)C++17
100 / 100
44 ms692 KiB
#include <combo.h> #include <bits/stdc++.h> using namespace std; //int press(string aaaaaaaaaaa); string guess_sequence(int n) { vector<string>ask(4,""); string s=""; char lost; if(press("AB")) { if(press("A")) lost='Y',s+='A',ask[0]+='B',ask[1]="XY",ask[2]="XB",ask[3]="XX"; else lost='Y',s+='B',ask[0]+='A',ask[1]="XA",ask[2]="XY",ask[3]="XX"; } else { if(press("X"))lost='Y',s+='X',ask[0]+='B',ask[1]="AA",ask[2]="AB",ask[3]="AY"; else lost='A',s+='Y',ask[0]+='B',ask[1]="XA",ask[2]="XB",ask[3]="XX"; } if(n == 1) return s; for(int i = 1 ; i < n-1 ; i++) { int cnt = press(s+ask[0]+s+ask[1]+s+ask[2]+s+ask[3]); if(cnt == i) { s+=lost; } else if(cnt == i+1) { s+=ask[0]; } else s+=ask[1][0]; } int asked = 0; if(s[0] != 'A') { if(press(s+'A') == n) { s+='A'; return s; } asked++; } if(s[0] != 'B') { if(press(s+'B') == n) { s+='B'; return s; } asked++; } if(s[0] != 'X') { if(asked == 2) return s+'X'; else { if(press(s+'X') == n) return s+'X'; else asked++; } } s+='Y'; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...