# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773125 | aykhn | Password (RMI18_password) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}