Submission #967273

#TimeUsernameProblemLanguageResultExecution timeMemory
967273AlesL0Combo (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int press(string p); string guess_sequence(int N){ string sol = ""; vector <char> c = {'a', 'b', 'x', 'y'}; int missing; if (press("ab")){ if (press("a"))missing = 0; else missing = 1; } else { if (press("x"))missing = 2; else missing = 3; } c.erase(c.begin()+missing); while (sol.size() < N){ if (sol.size() + 1 == N){ string t = sol; t += c[0]; t += sol; t += c[1]; if (press(t) == N){ t = sol; t += c[0]; if (press(t))sol += c[0]; else sol += c[1]; } else sol += c[2]; } else { string t = sol; t += c[0]; t += c[0]; t += sol; t += c[0]; t += c[1]; t += sol; t += c[0]; t += c[2]; t += sol; t += c[1]; int x = press(t); if (x == sol.size())sol += c[2]; else if (x == sol.size()+1)sol += c[1]; else sol += c[0]; } } return sol; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     while (sol.size() < N){
      |            ~~~~~~~~~~~^~~
combo.cpp:23:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |         if (sol.size() + 1 == N){
      |             ~~~~~~~~~~~~~~~^~~~
combo.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             if (x == sol.size())sol += c[2];
      |                 ~~^~~~~~~~~~~~~
combo.cpp:50:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             else if (x == sol.size()+1)sol += c[1];
      |                      ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...