답안 #973421

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
      |       ~~~~~~~~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 53 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 1200 KB Returned early from guess() after 3162 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Returned early from guess() after 187 queries.
2 Halted 0 ms 0 KB -