Submission #995614

#TimeUsernameProblemLanguageResultExecution timeMemory
995614daffuwuCombo (IOI18_combo)C++14
5 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { int i, j, cur; char ch; string s = "", guess="ABXY", t; //tentuin karakter pertama dulu if (press("AB")>0) { if (press("A")) s += 'A'; else s += 'B'; } else if (press("X")) s += 'X'; else s += 'Y'; for (i=0; i<4; i++) { if (guess[i] == s[0]) { guess.erase(guess.begin()+i); break; } } for (i=2; i<=n-1; i++) { //p00 p01 p02 p1 // printf("s now = %s\n", s.c_str()); t = ""; for (j=0; j<=2; j++) t += s+guess[0]+guess[j]; t += s+guess[1]; cur = press(t)-i+1; s += guess[2-(cur)]; } //karakter terakhir ch = guess[2]; for (i=0; i<=1; i++) { if (press(s+guess[i]) == n) ch = guess[i]; } s += ch; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...