Submission #967279

# Submission time Handle Problem Language Result Execution time Memory
967279 2024-04-21T17:06:21 Z AlesL0 Combo (IOI18_combo) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

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;
    }
    sol += c[missing];
    c.erase(c.begin()+missing);
    while (sol.size() < N){
        if (sol.size()+1 == N){
            string t = sol+c[0]+sol+c[1];
            if (press(t) == N){
                t = sol+c[0];
                if (press(t))sol += c[0];
                else sol += c[1];
            }
            else sol += c[2];
        }
        else {
            string t = sol+c[0]+c[0]+sol+c[0]+c[1]+sol+c[0]+c[2]+sol+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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     while (sol.size() < N){
      |            ~~~~~~~~~~~^~~
combo.cpp:21:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |         if (sol.size()+1 == N){
      |             ~~~~~~~~~~~~~^~~~
combo.cpp:33:19: 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 (x == sol.size())sol += c[2];
      |                 ~~^~~~~~~~~~~~~
combo.cpp:34:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |             else if (x == sol.size()+1)sol += c[1];
      |                      ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Wrong Answer: wrong guess.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Wrong Answer: wrong guess.
7 Halted 0 ms 0 KB -