제출 #1111476

#제출 시각아이디문제언어결과실행 시간메모리
1111476SalihSahin콤보 (IOI18_combo)C++14
100 / 100
53 ms1724 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; p = "AB"; c = press(p); if(c > 0){ p = "A"; c = press(p); if(c > 0) ans = "A"; else ans = "B"; } else{ p = "X"; c = press(p); if(c > 0) ans = "X"; else ans = "Y"; } if(N == 1){ return ans; } 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-2; i++){ //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] + 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-1; 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...