제출 #778663

#제출 시각아이디문제언어결과실행 시간메모리
778663Silence콤보 (IOI18_combo)C++17
10 / 100
42 ms720 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string s; string ans; auto third_subtask = [&](int n){ string cur = "ABXY"; string s; string ans; for (int i = 0;i<4;++i){ string t; t+=cur[i]; if (press(t) == 1){ for (int j = 0;j<4;++j){ if (i == j)continue; s+=cur[j]; } ans+=cur[i]; break; } } if (n == 1)return ans; //n + 1 + n + 2 for (int i = 0;i<n - 2;++i){ string p = ans; p+=s[0]; for (int j = 0;j<3;++j){ string t = ans; t+=s[1]; t+=s[j]; p+=t; } if (press(p) == i + 2){ ans+=s[0]; } else if (press(p) == i + 1){ ans+=s[2]; } else{ ans+=s[1]; } } for (int i = 0;i<3;++i){ ans+=s[i]; if (press(ans) == n){ return ans; } ans.pop_back(); } return ans; }; string v = third_subtask(N); //cout<<v<<'\n'; return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...