# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
251370 | dwsc | Password (RMI18_password) | C++14 | 929 ms | 760 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>
using namespace std;
int query(string str);
vector<string> mergevector(vector<string> v){
vector<string> newvector;
for (int i = 0; i < v.size(); i+= 2){
if (i == v.size()-1){
newvector.push_back(v[i]);
break;
}
string s1 = v[i],s2 = v[i+1];
//cout << s1 << " " << s2 << "hi\n";
string newstring = s1;
int insertionpos = 0;
int curpos = 0;
while (curpos < s2.length()){
string temp = "";
for (int j = 0; j < newstring.length(); j++){
if (j == insertionpos) temp += s2[curpos];
temp += newstring[j];
}
if (insertionpos == newstring.length()) temp += s2[curpos];
if (query(temp) == temp.length()){
newstring = temp;
curpos++;
insertionpos++;
}
else{
insertionpos++;
}
}
//cout << newstring << "\n";
newvector.push_back(newstring);
}
return newvector;
}
string guess(int n, int s){
vector<string> letters;
for (int i = 0; i < s; i++){
int ans = 0;
char c = (char)(i+97);
string act = "";
for (int j = 1; j <= n; j++){
string temp = act+c;
if (query(temp) == ans) break;
act = temp;
ans++;
}
//cout << act << "\n";
if (ans) letters.push_back(act);
}
while (letters.size() > 1)letters = mergevector(letters);
return letters[0];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |