Submission #639888

#TimeUsernameProblemLanguageResultExecution timeMemory
639888haxormanCombo (IOI18_combo)C++14
0 / 100
0 ms208 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; guess += s + letters[0]; if (s.size() < N - 1) { for (int i = 0; i < 3; ++i) { guess += s + letters[1] + letters[i]; } } else { guess += s + letters[1]; } //cout << s << ' ' << guess << "\n"; int coins = press(guess); if (coins == s.size()) { s += letters[2]; } else if (s.size() == N - 1) { guess = s + letters[0]; coins = press(guess); if (coins == s.size()) { s += letters[1]; } else { s += letters[0]; } } else if (coins == s.size() + 1) { s += letters[0]; } else { s += letters[1]; } } cout << s << "\n"; 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:29:16: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |   if (s.size() < N - 1) {
      |       ~~~~~~~~~^~~~~~~
combo.cpp:40:13: 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()) {
      |       ~~~~~~^~~~~~~~~~~
combo.cpp:43:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |   else if (s.size() == N - 1) {
      |            ~~~~~~~~~^~~~~~~~
combo.cpp:47:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |    if (coins == s.size()) {
      |        ~~~~~~^~~~~~~~~~~
combo.cpp:54:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |   else if (coins == s.size() + 1) {
      |            ~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...