제출 #1211369

#제출 시각아이디문제언어결과실행 시간메모리
1211369lukasuliashvili콤보 (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { /*A B X Y*/ if (N==3) { string all = "ABXY"; string candidate; for (char c1 : all) { for (char c2 : all) { for (char c3 : all) { candidate = {c1, c2, c3}; if (press(candidate) == 3) { return candidate; } } } } return ""; } string p=""; string p1="AB"; int ans=press(p1); if (ans==1 or ans==2) { string psome="A"; int ansk=press(psome); if (ansk==1) { p+=psome; } else { p+='B'; } } if (ans==0) { string p2="X"; int ans2=press(p2); if (ans2==1) { p+=p2; } else { p+='Y'; } } char fix1, fix2, fix3; if (p[0] == 'X') { fix1 = 'A'; fix2 = 'B'; fix3 = 'Y'; } if (p[0] == 'Y') { fix1 = 'A'; fix2 = 'B'; fix3 = 'X'; } if (p[0] == 'A') { fix1 = 'X'; fix2 = 'B'; fix3 = 'Y'; } if (p[0] == 'B') { fix1 = 'A'; fix2 = 'X'; fix3 = 'Y'; } while (p.size() <N-2) { string q = p + fix1 + p + fix2 + fix3 + p + fix2 + fix1 + p + fix2 + fix2; int res = press(q); if (res == p.size()) { p += fix3; } else if (res == p.size() + 1) { p += fix1; } else { p += fix2; } } int k1=2; while (k1--) { int count1=press(p+"A"+p+"B"); if (count1==p.size()+1) { int cnt1=press(p+"A"); if (cnt1==p.size()+1) { p+="A"; } else { p+="B"; } } else { int cnt2=press(p+"X"); if (cnt2==p.size()+1) { p+="X"; } else { p+="Y"; } } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...