Submission #106806

#TimeUsernameProblemLanguageResultExecution timeMemory
106806LamoreauxAJCombo (IOI18_combo)C++14
0 / 100
1 ms256 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; 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"; } vector<char> rem = {'A', 'B', 'X', 'Y'}; for (int i = 0; i < rem.size(); i++) { if (rem[i] == S[0]) { rem.erase(rem.begin() + i); break; } } for (int i = 1; i < N; i++) { string P = S + rem[0] + S + rem[1] + rem[0] + S + rem[1] + rem[2]; int coins = press(P); if (coins == S.size()) S += rem[2]; else if (coins == S.size() + 1) S += rem[0]; else S += rem[1]; } return S; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for (int i = 0; i < rem.size(); i++) {
      |                   ~~^~~~~~~~~~~~
combo.cpp:29:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |       if (coins == S.size())
      |           ~~~~~~^~~~~~~~~~~
combo.cpp:31:22: 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)
      |                ~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...