Submission #786547

#TimeUsernameProblemLanguageResultExecution timeMemory
786547JoenPoenManCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "grader.cpp" #include "combo.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; vector<char> chars = {'X', 'Y', 'A', 'B'}; string Sol; std::string guess_sequence(int N) { if (press("AB") >= 1) Sol = (press("A") ? "A" : "B"); else Sol = (press("X") ? "X" : "Y"); chars.erase(find(chars.begin(), chars.end(), Sol[0])); for (int i = 1; i < N-1; i++) { string inp; inp += Sol + chars[0]; inp += Sol + chars[1] + chars[0]; inp += Sol + chars[1] + chars[1]; inp += Sol + chars[1] + chars[2]; int res = press(inp); if (res == Sol.length()) Sol.push_back(chars[2]); else if (res == Sol.length()+1) Sol.push_back(chars[0]); else Sol.push_back(chars[1]); } string inp; inp = Sol + chars[0] + Sol + chars[1]; if (press(inp) == Sol.length()) Sol.push_back(chars[2]); else { inp = Sol + chars[0]; if (press(inp) == Sol.length()) Sol.push_back(chars[1]); else Sol.push_back(chars[0]); } return Sol; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         if (res == Sol.length()) Sol.push_back(chars[2]);
      |             ~~~~^~~~~~~~~~~~~~~
combo.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         else if (res == Sol.length()+1) Sol.push_back(chars[0]);
      |                  ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     if (press(inp) == Sol.length()) Sol.push_back(chars[2]);
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:35:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         if (press(inp) == Sol.length()) Sol.push_back(chars[1]);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccqvVQjl.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cc11X8Hl.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccqvVQjl.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc11X8Hl.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status