Submission #685876

#TimeUsernameProblemLanguageResultExecution timeMemory
685876grossly_overconfidentCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<char> letter; string result; if (press("AB") != 0) { if (press("A") == 1) { result = "A"; letter = { 'B', 'X', 'Y' }; } else { result = "B"; letter = { 'A', 'X', 'Y' }; } } else { if (press("X") == 1) { result = "X"; letter = { 'B', 'A', 'Y' }; } else { result = "Y"; letter = { 'B', 'X', 'A' }; } } string result = f; while (result.size() < N) { if (result.size() == N - 1) { if (press(result + letter[0]) > result.size()) { result += letter[0]; } else if (press(result + letter[1]) > result.size()) { result += letter[1]; } else { result += letter[2]; } } else{ int outcome = press(result + letter[0] + letter[1] + result + letter[1] + letter[0]); if (outcome == result.size()) { result += letter[2]; } else if (outcome == result.size() + 2) { if (press(result + letter[0] + letter[1]) == result.size()) { result += letter[1] + letter[0]; } else { result += letter[0] + letter[1]; } } else { if (press(result + letter[0] + letter[2]) == result.size()) { result += letter[1] + letter[2]; } else { result += letter[0] + letter[2]; } } } } return result; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:12: error: redeclaration of 'std::string result'
   27 |     string result = f;
      |            ^~~~~~
combo.cpp:6:12: note: 'std::string result' previously declared here
    6 |     string result;
      |            ^~~~~~
combo.cpp:27:21: error: 'f' was not declared in this scope
   27 |     string result = f;
      |                     ^
combo.cpp:28:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |     while (result.size() < N) {
      |            ~~~~~~~~~~~~~~^~~
combo.cpp:29:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |         if (result.size() == N - 1) {
      |             ~~~~~~~~~~~~~~^~~~~~~~
combo.cpp:30:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if (press(result + letter[0]) > result.size()) {
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:33:48: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |             else if (press(result + letter[1]) > result.size()) {
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:42:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             if (outcome == result.size()) {
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:45:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |             else if (outcome == result.size() + 2) {
      |                      ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
combo.cpp:46:59: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |                 if (press(result + letter[0] + letter[1]) == result.size()) {
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
combo.cpp:54:59: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |                 if (press(result + letter[0] + letter[2]) == result.size()) {
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~