Submission #585276

#TimeUsernameProblemLanguageResultExecution timeMemory
585276haxormanCombo (IOI18_combo)C++14
10 / 100
48 ms568 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s; vector<string> letters = {"A", "B", "X", "Y"}; for (string c : letters) { s += c; int coins = press(s); if (coins == s.size()) { break; } s.pop_back(); } for (int i = 0; i < 4; ++i) { if (letters[i].back() == s.back()) { letters.erase(letters.begin() + i); break; } } while (s.size() < N) { string guess; for (int i = 0; i < 2; ++i) { guess += s + letters[i]; } //cout << s << ' ' << guess << "\n"; int coins = press(guess); if (coins == s.size()) { s += letters[2]; } else { guess = s + letters[0]; coins = press(guess); if (coins == s.size()) { s += letters[1]; } else { s += letters[0]; } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   if (coins == s.size()) {
      |       ~~~~~~^~~~~~~~~~~
combo.cpp:25:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |  while (s.size() < N) {
      |         ~~~~~~~~~^~~
combo.cpp:33:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   if (coins == s.size()) {
      |       ~~~~~~^~~~~~~~~~~
combo.cpp:40:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |    if (coins == s.size()) {
      |        ~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...