Submission #698546

#TimeUsernameProblemLanguageResultExecution timeMemory
698546SebCombo (IOI18_combo)C++17
0 / 100
1 ms240 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

string guess_sequence(int N) {
    string ans = "", corte = "Y", a = "A", b = "B", c = "X";
    ll aux,i;
    aux = press(corte+a);
    if (aux==1) {
        if (press(a)==1) swap(corte,a);
    }
    else {
        if (press(b)==1) swap(corte,b);
        else swap(corte,c);
    }
    ans = ans+corte;
    for (i=1;i<N-1;i++) {
        aux = press(ans+a+ans+b+a+ans+b+c+ans+b+b);
        if (aux==ans.size()+1) ans = ans+a;
        else if (aux==ans.size()+2) ans = ans+b;
        else ans = ans+c;
    }
    if (N>1) {
        aux = press(ans+a+ans+b);
        if (aux==ans.size()+1) {
            if (press(ans+a)==ans.size()+1) ans = ans + a;
            else ans = ans + b;
        }
        else {
            ans = ans+c;
        }
    }
    return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if (aux==ans.size()+1) ans = ans+a;
      |             ~~~^~~~~~~~~~~~~~
combo.cpp:23:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         else if (aux==ans.size()+2) ans = ans+b;
      |                  ~~~^~~~~~~~~~~~~~
combo.cpp:28:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         if (aux==ans.size()+1) {
      |             ~~~^~~~~~~~~~~~~~
combo.cpp:29:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if (press(ans+a)==ans.size()+1) ans = ans + a;
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...