Submission #1009402

#TimeUsernameProblemLanguageResultExecution timeMemory
1009402IncreedibleCombo (IOI18_combo)C++14
10 / 100
35 ms1936 KiB
#include "combo.h" #include <string> using namespace std; string getGuess(int N, string s, char c) { string cur = ""; int am = 1; while (cur.size() + s.size() + am <= N * 4) { cur += s + string(am, c); am++; } return cur; } string guess_sequence(int N) { string s = ""; int oldcoins = 0; while (s.size() < N) { if (s.size() == 0) { if (press(s + "A") > oldcoins) { oldcoins++; s += "A"; } else if (press(s + "B") > oldcoins) { oldcoins++; s += "B"; } else if (press(s + "X") > oldcoins) { oldcoins++; s += "X"; } else if (press(s + "Y") > oldcoins) { oldcoins++; s += "Y"; } } else { s += string(press(getGuess(N, s, 'A')) - s.size(), 'A'); if (s.size() >= N) break; s += string(press(getGuess(N, s, 'B')) - s.size(), 'B'); if (s.size() >= N) break; s += string(press(getGuess(N, s, 'X')) - s.size(), 'X'); if (s.size() >= N) break; s += string(press(getGuess(N, s, 'Y')) - s.size(), 'Y'); if (s.size() >= N) break; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string getGuess(int, std::string, char)':
combo.cpp:8:39: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    8 |     while (cur.size() + s.size() + am <= N * 4) {
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   18 |     while (s.size() < N) {
      |            ~~~~~~~~~^~~
combo.cpp:35:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |             if (s.size() >= N) break;
      |                 ~~~~~~~~~^~~~
combo.cpp:37:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |             if (s.size() >= N) break;
      |                 ~~~~~~~~~^~~~
combo.cpp:39:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |             if (s.size() >= N) break;
      |                 ~~~~~~~~~^~~~
combo.cpp:41:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |             if (s.size() >= N) break;
      |                 ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...