Submission #280413

#TimeUsernameProblemLanguageResultExecution timeMemory
280413amallaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { if (press("A")) { string M = "BXY", S = "A", control; if (N==1) return S; for (int i = 0; i<N-1; ++i) { control = S+M[0]+M[0]; control += S+M[0]+M[1]; control += S+M[0]+M[2]; control += S+M[1]; int coins = press(control); if (coins==S.size()) S+=M[2]; else if (coins==S.size()+1) S+=M[1]; else S+=M[0]; } } else if (press("B")) { string M = "AXY", S = "B", control; if (N==1) return S; for (int i = 0; i<N-1; ++i) { control = S+M[0]+M[0]; control += S+M[0]+M[1]; control += S+M[0]+M[2]; control += S+M[1]; int coins = press(control); if (coins==S.size()) S+=M[2]; else if (coins==S.size()+1) S+=M[1]; else S+=M[0]; } } else if (press("X")) { string M = "ABY", S = "X", control; if (N==1) return S; for (int i = 0; i<N-1; ++i) { control = S+M[0]+M[0]; control += S+M[0]+M[1]; control += S+M[0]+M[2]; control += S+M[1]; int coins = press(control); if (coins==S.size()) S+=M[2]; else if (coins==S.size()+1) S+=M[1]; else S+=M[0]; } } else { string M = "ABX", S = "Y", control; if (N==1) return S; for (int i = 0; i<N-1; ++i) { control = S+M[0]+M[0]; control += S+M[0]+M[1]; control += S+M[0]+M[2]; control += S+M[1]; int coins = press(control); if (coins==S.size()) S+=M[2]; else if (coins==S.size()+1) S+=M[1]; else S+=M[0]; } } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:22: 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 (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:17:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             else if (coins==S.size()+1) S+=M[1];
      |                      ~~~~~^~~~~~~~~~~~
combo.cpp:30:22: 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 (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:31:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             else if (coins==S.size()+1) S+=M[1];
      |                      ~~~~~^~~~~~~~~~~~
combo.cpp:44:22: 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 (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:45:27: 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 (coins==S.size()+1) S+=M[1];
      |                      ~~~~~^~~~~~~~~~~~
combo.cpp:58:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |             if (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:59:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             else if (coins==S.size()+1) S+=M[1];
      |                      ~~~~~^~~~~~~~~~~~
combo.cpp:63:12: error: 'S' was not declared in this scope
   63 |     return S;
      |            ^