Submission #471575

#TimeUsernameProblemLanguageResultExecution timeMemory
471575Cross_RatioCombo (IOI18_combo)C++14
30 / 100
59 ms704 KiB
#include <bits/stdc++.h>
//#include "combo.h"
using namespace std;


int press(string);

string guess_sequence(int N) {
    int isA = press("AB");
    string st;
    if(isA) {
        int isB = press("B");
        if(isB) st = "B";
        else st = "A";
    }
    else {
        int isD = press("X");
        if(isD) st = "X";
        else st = "Y";
    }
    while(st.length() < N) {
        string s1 = st + "A" + st + "B";
        if(press(s1) == st.length() + 1) {
            if(press(st + "A") == st.length() + 1) {
                st = st + "A";
            }
            else st = st + "B";
        }
        else {
            if(press(st + "X") == st.length() + 1) {
                st = st + "X";
            }
            else st = st + "Y";
        }
    }
    return st;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:21:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |     while(st.length() < N) {
      |           ~~~~~~~~~~~~^~~
combo.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         if(press(s1) == st.length() + 1) {
      |            ~~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:24:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             if(press(st + "A") == st.length() + 1) {
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
combo.cpp:30:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             if(press(st + "X") == st.length() + 1) {
      |                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...