Submission #709087

# Submission time Handle Problem Language Result Execution time Memory
709087 2023-03-13T06:08:50 Z jamezzz Password (RMI18_password) C++17
50 / 100
462 ms 448 KB
#include <bits/stdc++.h>
using namespace std;

int query(string str);

string guess(int n,int s){
	string ans="";
	int pv=0;
	for(int i=0;i<s;++i){
		char c='a'+i;
		for(int j=0;j<ans.length();++j){
			string tmp=ans;
			tmp.insert(j,1,c);
			int res=query(tmp);
			if(res>pv){
				pv=res;
				swap(tmp,ans);
				tmp.clear();
				if(pv==n)return ans;
				continue;
			}
			else tmp.clear();
		}
		string tmp=ans;
		tmp.insert(tmp.length(),n-tmp.length(),c);
		pv=query(tmp);
		tmp.resize(pv);
		swap(ans,tmp);
		tmp.clear();
		if(pv==n)return ans;
	}
	return ans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:11:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   for(int j=0;j<ans.length();++j){
      |               ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Guessed the password with 130 queries.
2 Correct 3 ms 208 KB Guessed the password with 290 queries.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Guessed the password with 47 queries.
2 Correct 2 ms 208 KB Guessed the password with 118 queries.
3 Correct 1 ms 208 KB Guessed the password with 90 queries.
4 Correct 3 ms 208 KB Guessed the password with 214 queries.
# Verdict Execution time Memory Grader output
1 Correct 26 ms 448 KB Guessed the password with 4737 queries.
2 Correct 121 ms 348 KB Guessed the password with 10641 queries.
3 Correct 82 ms 444 KB Guessed the password with 14308 queries.
4 Correct 141 ms 356 KB Guessed the password with 20788 queries.
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Guessed the password with 130 queries.
2 Correct 3 ms 208 KB Guessed the password with 290 queries.
3 Correct 1 ms 256 KB Guessed the password with 47 queries.
4 Correct 2 ms 208 KB Guessed the password with 118 queries.
5 Correct 1 ms 208 KB Guessed the password with 90 queries.
6 Correct 3 ms 208 KB Guessed the password with 214 queries.
7 Correct 26 ms 448 KB Guessed the password with 4737 queries.
8 Correct 121 ms 348 KB Guessed the password with 10641 queries.
9 Correct 82 ms 444 KB Guessed the password with 14308 queries.
10 Correct 141 ms 356 KB Guessed the password with 20788 queries.
11 Incorrect 462 ms 320 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 208 KB Guessed the password with 130 queries.
2 Correct 3 ms 208 KB Guessed the password with 290 queries.
3 Correct 1 ms 256 KB Guessed the password with 47 queries.
4 Correct 2 ms 208 KB Guessed the password with 118 queries.
5 Correct 1 ms 208 KB Guessed the password with 90 queries.
6 Correct 3 ms 208 KB Guessed the password with 214 queries.
7 Correct 26 ms 448 KB Guessed the password with 4737 queries.
8 Correct 121 ms 348 KB Guessed the password with 10641 queries.
9 Correct 82 ms 444 KB Guessed the password with 14308 queries.
10 Correct 141 ms 356 KB Guessed the password with 20788 queries.
11 Incorrect 462 ms 320 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -