Submission #1111459

#TimeUsernameProblemLanguageResultExecution timeMemory
1111459SalihSahinCombo (IOI18_combo)C++14
5 / 100
1 ms336 KiB
#include <bits/stdc++.h> #define pb push_back #include "combo.h" using namespace std; string guess_sequence(int N) { string p = "", ans = ""; vector<char> pos; pos.pb('A'); pos.pb('B'); pos.pb('X'); pos.pb('Y'); int c; for(auto itr: pos){ p = itr; c = press(p); if(c > 0){ ans += itr; break; } } vector<char> other; if(ans == "A"){ other.pb('B'); other.pb('X'); other.pb('Y'); } if(ans == "B"){ other.pb('A'); other.pb('X'); other.pb('Y'); } if(ans == "X"){ other.pb('B'); other.pb('A'); other.pb('Y'); } if(ans == "Y"){ other.pb('B'); other.pb('X'); other.pb('A'); } for(int i = 1; i <= N-3; i++){ p = ans + other[1] + ans + other[2] + other[0] + ans + other[2] + other[1] + ans + other[2] + other[2]; int len = press(p); if(len == i) ans += other[0]; else if(len == i + 1){ ans += other[1]; } else ans += other[2]; } for(int i = N-2; i <= N-1; i++){ p = ""; //p += (ans + other[1]); // just add other[1] //p += (ans + other[2] + other[0]); //p += (ans + other[2] + other[1]); //p += (ans + other[2] + other[2]); p = ans + other[1] + ans + other[2]; int len = press(p); if(len == i) ans += other[0]; else if(len == i + 1){ p = ans + other[1]; len = press(p); if(len == i + 1) ans += other[1]; else ans += other[2]; } } /* for(int i = 0; i < 2; i++){ p = ans + other[i]; c = press(p); if(c == N){ ans += other[i]; break; } } if(ans.size() < N) ans += other[2]; */ return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...