Submission #199657

# Submission time Handle Problem Language Result Execution time Memory
199657 2020-02-02T13:18:55 Z mohammedehab2002 Password (RMI18_password) C++14
100 / 100
436 ms 780 KB
#include <bits/stdc++.h>
using namespace std;
int 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));
	string ans="";
	for (char a='a';a<'a'+c;a++)
	{
		int p=ans.size();
		string tmp=ans;
		for (int i=0;i<f[a-'a'];i++)
		{
			while (p>=31 && query(ans.substr(0,p-31)+string(i+1,a))<=p-31+i)
			p-=32;
			int st=max(p-31,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 6 ms 248 KB Guessed the password with 58 queries.
2 Correct 6 ms 248 KB Guessed the password with 100 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Guessed the password with 72 queries.
2 Correct 7 ms 376 KB Guessed the password with 112 queries.
3 Correct 5 ms 376 KB Guessed the password with 15 queries.
4 Correct 7 ms 256 KB Guessed the password with 366 queries.
# Verdict Execution time Memory Grader output
1 Correct 60 ms 376 KB Guessed the password with 5462 queries.
2 Correct 79 ms 248 KB Guessed the password with 6985 queries.
3 Correct 91 ms 248 KB Guessed the password with 8940 queries.
4 Correct 149 ms 248 KB Guessed the password with 11628 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 248 KB Guessed the password with 58 queries.
2 Correct 6 ms 248 KB Guessed the password with 100 queries.
3 Correct 6 ms 376 KB Guessed the password with 72 queries.
4 Correct 7 ms 376 KB Guessed the password with 112 queries.
5 Correct 5 ms 376 KB Guessed the password with 15 queries.
6 Correct 7 ms 256 KB Guessed the password with 366 queries.
7 Correct 60 ms 376 KB Guessed the password with 5462 queries.
8 Correct 79 ms 248 KB Guessed the password with 6985 queries.
9 Correct 91 ms 248 KB Guessed the password with 8940 queries.
10 Correct 149 ms 248 KB Guessed the password with 11628 queries.
11 Correct 190 ms 504 KB Guessed the password with 13672 queries.
12 Correct 179 ms 248 KB Guessed the password with 16305 queries.
13 Correct 187 ms 428 KB Guessed the password with 16687 queries.
14 Correct 191 ms 376 KB Guessed the password with 17437 queries.
15 Correct 166 ms 504 KB Guessed the password with 16894 queries.
16 Correct 244 ms 504 KB Guessed the password with 18525 queries.
17 Correct 181 ms 504 KB Guessed the password with 17065 queries.
18 Correct 225 ms 248 KB Guessed the password with 19211 queries.
19 Correct 216 ms 504 KB Guessed the password with 16533 queries.
20 Correct 242 ms 376 KB Guessed the password with 19847 queries.
21 Correct 270 ms 504 KB Guessed the password with 18266 queries.
22 Correct 239 ms 380 KB Guessed the password with 20990 queries.
# Verdict Execution time Memory Grader output
1 Correct 6 ms 248 KB Guessed the password with 58 queries.
2 Correct 6 ms 248 KB Guessed the password with 100 queries.
3 Correct 6 ms 376 KB Guessed the password with 72 queries.
4 Correct 7 ms 376 KB Guessed the password with 112 queries.
5 Correct 5 ms 376 KB Guessed the password with 15 queries.
6 Correct 7 ms 256 KB Guessed the password with 366 queries.
7 Correct 60 ms 376 KB Guessed the password with 5462 queries.
8 Correct 79 ms 248 KB Guessed the password with 6985 queries.
9 Correct 91 ms 248 KB Guessed the password with 8940 queries.
10 Correct 149 ms 248 KB Guessed the password with 11628 queries.
11 Correct 190 ms 504 KB Guessed the password with 13672 queries.
12 Correct 179 ms 248 KB Guessed the password with 16305 queries.
13 Correct 187 ms 428 KB Guessed the password with 16687 queries.
14 Correct 191 ms 376 KB Guessed the password with 17437 queries.
15 Correct 166 ms 504 KB Guessed the password with 16894 queries.
16 Correct 244 ms 504 KB Guessed the password with 18525 queries.
17 Correct 181 ms 504 KB Guessed the password with 17065 queries.
18 Correct 225 ms 248 KB Guessed the password with 19211 queries.
19 Correct 216 ms 504 KB Guessed the password with 16533 queries.
20 Correct 242 ms 376 KB Guessed the password with 19847 queries.
21 Correct 270 ms 504 KB Guessed the password with 18266 queries.
22 Correct 239 ms 380 KB Guessed the password with 20990 queries.
23 Correct 436 ms 780 KB Guessed the password with 30024 queries.
24 Correct 397 ms 636 KB Guessed the password with 29656 queries.
25 Correct 351 ms 428 KB Guessed the password with 29594 queries.
26 Correct 419 ms 540 KB Guessed the password with 30841 queries.
27 Correct 372 ms 536 KB Guessed the password with 29482 queries.
28 Correct 361 ms 416 KB Guessed the password with 29621 queries.
29 Correct 348 ms 676 KB Guessed the password with 29425 queries.
30 Correct 381 ms 580 KB Guessed the password with 27139 queries.