| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 333358 | valerikk | Password (RMI18_password) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int query(string str);
string pushs(string s, char x) {
s.push_back(x);
return s;
}
string inserts(string s, int pos, char x) {
insert(s.begin() + pos, x);
return s;
}
string go(int l, int r) {
if (r - l == 1) {
string s = "";
char x = 'a' + l;
while (query(pushs(s, x)) == s.size() + 1) s.push_back(x);
return s;
}
int mid = (l + r) / 2;
auto s = go(l, mid), t = go(mid, r);
for (int i = 0, j = 0; i <= s.size() && j < t.size(); ++i) {
string kek = inserts(s, i, t[j]);
if (query(kek) == kek.size()) s = kek;
}
return s;
}
string guess(int n, int s) {
return go(0, s);
}
