Submission #199660

# Submission time Handle Problem Language Result Execution time Memory
199660 2020-02-02T13:26:01 Z mohammedehab2002 Password (RMI18_password) C++14
100 / 100
349 ms 760 KB
#include <bits/stdc++.h>
using namespace std;
pair<int,char> f[26];
int query(string s);
string guess(int n,int c)
{
	for (char a='a';a<'a'+c;a++)
	f[a-'a']={query(string(n,a)),a};
	sort(f,f+26);
	string ans="";
	for (int j=0;j<26;j++)
	{
		char a=f[j].second;
		int p=ans.size();
		string tmp=ans;
		for (int i=0;i<f[j].first;i++)
		{
			while (p>=15 && query(ans.substr(0,p-15)+string(i+1,a))<=p-15+i)
			p-=16;
			int st=max(p-15,0),en=p;
			while (st!=en)
			{
				int mid=(st+en+1)/2;
				if (query(ans.substr(0,mid)+string(i+1,a))>mid+i)
				st=mid;
				else
				en=mid-1;
			}
			tmp.insert(tmp.begin()+st,a);
			p=st;
		}
		ans=tmp;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Guessed the password with 58 queries.
2 Correct 6 ms 248 KB Guessed the password with 105 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Guessed the password with 73 queries.
2 Correct 7 ms 248 KB Guessed the password with 225 queries.
3 Correct 5 ms 248 KB Guessed the password with 8 queries.
4 Correct 9 ms 376 KB Guessed the password with 384 queries.
# Verdict Execution time Memory Grader output
1 Correct 55 ms 376 KB Guessed the password with 4858 queries.
2 Correct 47 ms 316 KB Guessed the password with 6328 queries.
3 Correct 78 ms 376 KB Guessed the password with 7801 queries.
4 Correct 134 ms 380 KB Guessed the password with 10141 queries.
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Guessed the password with 58 queries.
2 Correct 6 ms 248 KB Guessed the password with 105 queries.
3 Correct 6 ms 376 KB Guessed the password with 73 queries.
4 Correct 7 ms 248 KB Guessed the password with 225 queries.
5 Correct 5 ms 248 KB Guessed the password with 8 queries.
6 Correct 9 ms 376 KB Guessed the password with 384 queries.
7 Correct 55 ms 376 KB Guessed the password with 4858 queries.
8 Correct 47 ms 316 KB Guessed the password with 6328 queries.
9 Correct 78 ms 376 KB Guessed the password with 7801 queries.
10 Correct 134 ms 380 KB Guessed the password with 10141 queries.
11 Correct 177 ms 376 KB Guessed the password with 13804 queries.
12 Correct 216 ms 332 KB Guessed the password with 13850 queries.
13 Correct 165 ms 760 KB Guessed the password with 15164 queries.
14 Correct 153 ms 584 KB Guessed the password with 15206 queries.
15 Correct 194 ms 248 KB Guessed the password with 15957 queries.
16 Correct 179 ms 324 KB Guessed the password with 15931 queries.
17 Correct 218 ms 504 KB Guessed the password with 16406 queries.
18 Correct 176 ms 376 KB Guessed the password with 16368 queries.
19 Correct 208 ms 504 KB Guessed the password with 16835 queries.
20 Correct 200 ms 504 KB Guessed the password with 16894 queries.
21 Correct 200 ms 432 KB Guessed the password with 17531 queries.
22 Correct 255 ms 504 KB Guessed the password with 17846 queries.
# Verdict Execution time Memory Grader output
1 Correct 5 ms 248 KB Guessed the password with 58 queries.
2 Correct 6 ms 248 KB Guessed the password with 105 queries.
3 Correct 6 ms 376 KB Guessed the password with 73 queries.
4 Correct 7 ms 248 KB Guessed the password with 225 queries.
5 Correct 5 ms 248 KB Guessed the password with 8 queries.
6 Correct 9 ms 376 KB Guessed the password with 384 queries.
7 Correct 55 ms 376 KB Guessed the password with 4858 queries.
8 Correct 47 ms 316 KB Guessed the password with 6328 queries.
9 Correct 78 ms 376 KB Guessed the password with 7801 queries.
10 Correct 134 ms 380 KB Guessed the password with 10141 queries.
11 Correct 177 ms 376 KB Guessed the password with 13804 queries.
12 Correct 216 ms 332 KB Guessed the password with 13850 queries.
13 Correct 165 ms 760 KB Guessed the password with 15164 queries.
14 Correct 153 ms 584 KB Guessed the password with 15206 queries.
15 Correct 194 ms 248 KB Guessed the password with 15957 queries.
16 Correct 179 ms 324 KB Guessed the password with 15931 queries.
17 Correct 218 ms 504 KB Guessed the password with 16406 queries.
18 Correct 176 ms 376 KB Guessed the password with 16368 queries.
19 Correct 208 ms 504 KB Guessed the password with 16835 queries.
20 Correct 200 ms 504 KB Guessed the password with 16894 queries.
21 Correct 200 ms 432 KB Guessed the password with 17531 queries.
22 Correct 255 ms 504 KB Guessed the password with 17846 queries.
23 Correct 305 ms 668 KB Guessed the password with 26984 queries.
24 Correct 311 ms 480 KB Guessed the password with 26369 queries.
25 Correct 332 ms 540 KB Guessed the password with 26620 queries.
26 Correct 334 ms 664 KB Guessed the password with 25414 queries.
27 Correct 343 ms 676 KB Guessed the password with 26389 queries.
28 Correct 349 ms 668 KB Guessed the password with 25046 queries.
29 Correct 337 ms 576 KB Guessed the password with 26228 queries.
30 Correct 301 ms 540 KB Guessed the password with 24800 queries.