Submission #106200

#TimeUsernameProblemLanguageResultExecution timeMemory
106200tictaccatCombo (IOI18_combo)C++14
30 / 100
81 ms444 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; vector<char> chars {'A','B','X','Y'}; std::string guess_sequence(int N) { srand(time(NULL)); string ans = ""; //find first character, 2.25 guesses char firstChar = '#'; random_shuffle(chars.begin(),chars.end()); for (int i = 0; i < 3; i++) { if (press(ans+chars[i]) > 0) { firstChar = chars[i]; break; } } if (firstChar == '#') firstChar = chars[3]; ans += firstChar; //each character 5/3 guesses while (ans.size() < N) { char nextChar = '#'; random_shuffle(chars.begin(),chars.end()); for (int i = 0; i < 3; i++) { if (chars[i] == firstChar) continue; if (press(ans+chars[i]) > ans.size()) { nextChar = chars[i]; break; } } if (nextChar == '#') nextChar = chars[3]; ans += nextChar; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |   while (ans.size() < N) {
      |          ~~~~~~~~~~~^~~
combo.cpp:37:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |       if (press(ans+chars[i]) > ans.size()) {
      |           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...