답안 #709069

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
709069 2023-03-13T05:54:08 Z jamezzz Password (RMI18_password) C++17
50 / 100
490 ms 480 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()+1;++j){
			string tmp=ans;
			tmp.insert(j,1,c);
			int res=query(tmp);
			if(res>pv){
				pv=res;
				swap(tmp,ans);
				if(pv==n)return ans;
				continue;
			}
		}
	}
	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()+1;++j){
      |               ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 288 KB Guessed the password with 133 queries.
2 Correct 3 ms 208 KB Guessed the password with 294 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Guessed the password with 71 queries.
2 Correct 2 ms 208 KB Guessed the password with 166 queries.
3 Correct 1 ms 304 KB Guessed the password with 102 queries.
4 Correct 2 ms 208 KB Guessed the password with 228 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 324 KB Guessed the password with 4807 queries.
2 Correct 104 ms 432 KB Guessed the password with 10754 queries.
3 Correct 150 ms 356 KB Guessed the password with 14365 queries.
4 Correct 201 ms 480 KB Guessed the password with 20878 queries.
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 288 KB Guessed the password with 133 queries.
2 Correct 3 ms 208 KB Guessed the password with 294 queries.
3 Correct 1 ms 208 KB Guessed the password with 71 queries.
4 Correct 2 ms 208 KB Guessed the password with 166 queries.
5 Correct 1 ms 304 KB Guessed the password with 102 queries.
6 Correct 2 ms 208 KB Guessed the password with 228 queries.
7 Correct 41 ms 324 KB Guessed the password with 4807 queries.
8 Correct 104 ms 432 KB Guessed the password with 10754 queries.
9 Correct 150 ms 356 KB Guessed the password with 14365 queries.
10 Correct 201 ms 480 KB Guessed the password with 20878 queries.
11 Incorrect 490 ms 364 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 288 KB Guessed the password with 133 queries.
2 Correct 3 ms 208 KB Guessed the password with 294 queries.
3 Correct 1 ms 208 KB Guessed the password with 71 queries.
4 Correct 2 ms 208 KB Guessed the password with 166 queries.
5 Correct 1 ms 304 KB Guessed the password with 102 queries.
6 Correct 2 ms 208 KB Guessed the password with 228 queries.
7 Correct 41 ms 324 KB Guessed the password with 4807 queries.
8 Correct 104 ms 432 KB Guessed the password with 10754 queries.
9 Correct 150 ms 356 KB Guessed the password with 14365 queries.
10 Correct 201 ms 480 KB Guessed the password with 20878 queries.
11 Incorrect 490 ms 364 KB Could not guess the password with 50000 queries.
12 Halted 0 ms 0 KB -