제출 #478285

#제출 시각아이디문제언어결과실행 시간메모리
478285ovidiush11콤보 (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; string guess_sequence(int n) { string s="",p="",a; int c,k; p = "AB"; c = press(p); if(c == 2) { k = 2; s = p; } else if(c == 1) { if(press("A") == 1)s = "A"; else s = "B"; k = 1; } else { if(press("Y") == 1)s = "Y"; else s = "X"; k = 1; } a[0] = s[0]; if(a[0] == 'A') { a[1] = 'B';a[2] = 'X';a[3] = 'Y'; } else if(a[0] == 'B') { a[1] = 'A';a[2] = 'X';a[3] = 'Y'; } else if(a[0] == 'X') { a[1] = 'B';a[2] = 'A';a[3] = 'Y'; } else if(a[0] == 'Y') { a[1] = 'B';a[2] = 'X';a[3] = 'A'; } for(;k < n-1;k++) { p = s + a[1] + a[2] + s + a[1] + a[3] + s + a[1] + a[1] + s + a[2]; c = press(p); if(c == k + 2)s = s + a[1]; else if(c == k + 1)s = s + a[2]; else s = s + a[3]; } p = s + a[1] + s + a[2]; c = press(p); if(c == k + 1) { if(press(s + a[1]) == k + 1)s = s + a[1]; else s = s + a[2]; } else s = s + a[3]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...