Submission #973421

# Submission time Handle Problem Language Result Execution time Memory
973421 2024-05-02T01:44:11 Z pcc Password (RMI18_password) C++17
0 / 100
16 ms 1200 KB
#include <bits/stdc++.h>
using namespace std;

int query(string s);

string guess(int N,int S){
	string tans;
	for(int i = 0;i+S<N;i++){
		int l = 0,r = S-1;
		string tmp;
		while(l != r){
			tmp = tans;
			int mid = (l+r)>>1;
			for(int j = l;j<=mid;j++)tmp += 'a'+j;
			if(query(tmp)>i)r = mid;
			else l = mid+1;
		}
		tans += 'a'+l;
	}
	for(int i = max(0,N-S);i<N;i++){
		for(int j = 0;j<S;j++){
			tans += 'a'+j;
			if(query(tans) == tans.size())break;
			tans.pop_back();
		}
	}
	return tans;
}

Compilation message

password.cpp: In function 'std::string guess(int, int)':
password.cpp:23:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |    if(query(tans) == tans.size())break;
      |       ~~~~~~~~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 53 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 1200 KB Returned early from guess() after 3162 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -