Submission #430834

#TimeUsernameProblemLanguageResultExecution timeMemory
430834BelguteiCombo (IOI18_combo)C++17
30 / 100
57 ms592 KiB
#include "combo.h"
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

string p,tur;
int coin;
vector<char> v;

std::string guess_sequence(int N) {
    //
    p='A';
    coin=press(p);
    if(coin==0){
        p='B';
        coin=press(p); 
        if(coin==0){
            p='X';
            coin=press(p);
            if(coin==0) p='Y';
        }
    }
    char ch=p[0];
    if(ch!='A') v.pb('A');
    if(ch!='B') v.pb('B');
    if(ch!='X') v.pb('X');
    if(ch!='Y') v.pb('Y');
    for(int i=2; i<=N; i++){
        tur=p+v[0]+p+v[1];
        coin=press(tur);
        if(coin==p.size()){
            p+=v[2];
            continue;
        }
        tur=p+v[0];
        coin=press(tur);
        if(coin==p.size()) p+=v[1];
        else p+=v[0];
    }
    return p;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         if(coin==p.size()){
      |            ~~~~^~~~~~~~~~
combo.cpp:43:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         if(coin==p.size()) p+=v[1];
      |            ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...