Submission #143562

#TimeUsernameProblemLanguageResultExecution timeMemory
143562mat_v콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;


string guess_sequence(int N) {
    string a = "AB";
    string b = "B";
    string x = "X";
    string tren;
    int prvi = press(a);
    if(prvi){
        a.clear();
        a += 'A';
        prvi = ask(a);
        if(prvi)tren = 'A';
        else tren = 'B';
    }
    else{
        prvi = ask(x);
        if(prvi)tren = 'X';
        else tren = 'Y';
    }
    string d,t,c;
    if(tren == "A"){
        d = "X";
        t = "Y";
        c = "B";
    }
    else if(tren == "B"){
        d = 'X';
        t = 'Y';
        c = 'A';
    }
    else if(tren == "X"){
        d = 'A';
        t = 'Y';
        c = 'B';
    }
    else if(tren == "Y"){
        d = 'X';
        t = 'A';
        c = 'B';
    }

    for(int i=1; i<N; i++){
        if(i == N-1){
            string frs = tren;
            frs += d;
            string frs2 = tren;
            frs2 += t;
            int sta = press(frs);
            int sta2 = press(frs2);
            if(sta > sta2)tren += d;
            else if(sta2 > sta)tren += t;
            else tren += c;
            continue;
        }
        string frs = tren;
        frs += d;
        string sek1 = tren,sek2 = tren,sek3 = tren;
        string pom1 = t;
        pom1 += t;
        string pom2 = t;
        pom2 += d;
        string pom3 = t;
        pom3 += c;
        sek1 += pom1;
        sek2 += pom2;
        sek3 += pom3;
        frs += sek1;
        frs += sek2;
        frs += sek3;
        int sta = press(frs);
        if(sta == tren.size())tren += c;
        else if(sta == tren.size() + 1)tren += d;
        else tren += t;

    }
    //cout << tren << endl;
    return tren;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:16: error: 'ask' was not declared in this scope
   16 |         prvi = ask(a);
      |                ^~~
combo.cpp:21:16: error: 'ask' was not declared in this scope
   21 |         prvi = ask(x);
      |                ^~~
combo.cpp:76:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |         if(sta == tren.size())tren += c;
      |            ~~~~^~~~~~~~~~~~~~
combo.cpp:77:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |         else if(sta == tren.size() + 1)tren += d;
      |                 ~~~~^~~~~~~~~~~~~~~~~~