Submission #710993

# Submission time Handle Problem Language Result Execution time Memory
710993 2023-03-16T06:52:45 Z Foxyy Combo (IOI18_combo) C++17
0 / 100
0 ms 208 KB
#include "combo.h"
#include <bits/stdc++.h>

char getSingleChar(std::string str) {
	char ret;
	if (press(str+"AB") > str.size()) {
		if (press(str+"A") > str.size()) {
			ret = 'A';
		} else {
			ret = 'B';
		}
	} else {
		if (press("X") > str.size()) {
			ret = 'X';
		} else {
			ret = 'Y';
		}
	}
	return ret;
}

std::string guess_sequence(int N) {
	char first = getSingleChar("");
	std::string str = std::string() + first;
	std::set<char> s{'A', 'B', 'X', 'Y'};
	s.erase(first);
	std::vector<char> cset(s.begin(), s.end());
	for (int i = 2; i < N; i++) {
		int c = press(str + cset[0] + str + cset[1] + cset[0] + str + cset[1] + cset[1] + str + cset[1] + cset[2]);
		if (c == i) {
			str += cset[0];
		} else if (c == i+1) {
			str += cset[1];
		} else {
			str += cset[2];
		}
	}
	char last = getSingleChar(str);
	return str+last;
}

Compilation message

combo.cpp: In function 'char getSingleChar(std::string)':
combo.cpp:6:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  if (press(str+"AB") > str.size()) {
      |      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   if (press(str+"A") > str.size()) {
      |       ~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   if (press("X") > str.size()) {
      |       ~~~~~~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer: wrong guess.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong Answer: wrong guess.
2 Halted 0 ms 0 KB -