답안 #867696

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867696 2023-10-29T08:37:41 Z franfill Password (RMI18_password) C++17
0 / 100
1 ms 440 KB
#include<bits/stdc++.h>
using namespace std;

int query(string S);

string cur = "";
int N, S;

int solve(int i, char c)
{
	if (c > 'z' || cur.size() == N)
		return 0;
	string tr = cur.substr(0, i);
	tr += c;
	tr += cur.substr(i, cur.size()-i);
	if (query(tr) == tr.size())
	{
		int ans = 1;
		cur = tr;
		ans += solve(i, c);
		ans += solve(i+ans, c+1);
		return ans;
	}
	else
		return solve(i, c+1);
}

string guess(int N, int S)
{	
	::N = N;
	::S = S;
	cur = "";
	assert(solve(0, 'a') == N);
	return cur;
}

Compilation message

password.cpp: In function 'int solve(int, char)':
password.cpp:11:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |  if (c > 'z' || cur.size() == N)
      |                 ~~~~~~~~~~~^~~~
password.cpp:16:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  if (query(tr) == tr.size())
      |      ~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 440 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -