# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
773125 | aykhn | Password (RMI18_password) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// author: aykhn
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define TC int t; cin >> t; while (t--) _();
#define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_setp tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
#define mpr make_pair
#define eb emplace_back
#define new int32_t
#define pb push_back
#define ts to_string
#define int ll
#define fi first
#define se second
#define ins insert
#define inf 0x3F3F3F3F
#define infll 0x3F3F3F3F3F3F3F3FLL
#define bpc __builtin_popcount
int query(string str);
string guess(int n, int s)
{
string ans = "";
int prev;
string x = "a";
for (int i = 0; i < s; i++)
{
ans = x + ans;
int X = query(ans);
prev = max(X, prev);
if (!X) ans = ans.substr(1, (int)(ans.length()) - 1);
for (int j = 1; j <= ans.length(); j++)
{
string asd = ans.substr(0, j);
string assd = ans.substr(j, (int)ans.length() - j);
ans = asd;
asd += x;
asd += assd;
int y = query(ans);
if (y <= prev)
{
asd = ans.substr(0, j);
assd = ans.substr(j + 1, (int)ans.length() - j - 1);
ans = asd + assd;
}
}
x[0]++;
}
return ans;
}