Submission #217795

#TimeUsernameProblemLanguageResultExecution timeMemory
217795kkm0476Combo (IOI18_combo)C++11
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; int press(string a) { return 0; } string guess_sequence(int N) { string S; if (press("AB")) { if (press("A")) S = "A"; else S = "B"; } else { if (press("X")) S = "X"; else S = "Y"; } while (S.size() < N - 1) { int l; switch (S[0]) { case 'A': l = press(S + "BB" + S + "BX" + S + "BY" + S + "X"); if (l == S.size() + 2) S += "B"; else if (l == S.size() + 1) S += "X"; else S += "Y"; break; case 'B': l = press(S + "AA" + S + "AX" + S + "AY" + S + "X"); if (l == S.size() + 2) S += "A"; else if (l == S.size() + 1) S += "X"; else S += "Y"; break; case 'X': l = press(S + "AA" + S + "AB" + S + "AY" + S + "B"); if (l == S.size() + 2) S += "A"; else if (l == S.size() + 1) S += "B"; else S += "Y"; break; case 'Y': l = press(S + "AA" + S + "AB" + S + "AX" + S + "B"); if (l == S.size() + 2) S += "A"; else if (l == S.size() + 1) S += "B"; else S += "X"; break; } } if (press(S + "A" + S + "B") == S.size()) { if (press(S + "A")) S += "A"; else S += "B"; } else { if (press(S + "X")) S += "X"; else S += "Y"; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:21: 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 (S.size() < N - 1)
      |            ~~~~~~~~~^~~~~~~
combo.cpp:35:19: 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 (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:37:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:44:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |             if (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:46:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:53:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |             if (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:55:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:62:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |             if (l == S.size() + 2)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:64:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |             else if (l == S.size() + 1)
      |                      ~~^~~~~~~~~~~~~~~
combo.cpp:71:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |     if (press(S + "A" + S + "B") == S.size())
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/bin/ld: /tmp/ccCiBupP.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/cclF2QGQ.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status