Submission #1007087

#TimeUsernameProblemLanguageResultExecution timeMemory
1007087makanhulia콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std; 
// #define int long long
// #define fi first 
// #define se second 
// #define pb push_back

string guess_sequence(int n){
    string s = ""; 
    int tmp = press("AB"); 
    if(tmp >= 1){
        tmp = press("A"); 
        if(tmp == 1){
            s += 'A'; 
        }
        else s += 'B'; 
    }
    else{
        tmp = press("X"); 
        if(tmp == 1){
            s += 'X'; 
        }
        else s += 'Y'; 
    }
    while(1){
        if(s[0] == 'X'){
            tmp = press(s + 'B' + s + "AA" + s + "AY" + s + "AB"); 
            if(tmp == s.length() + 1){
                s += 'B'; 
            }
            else if(tmp == s.length() + 2){
                s += 'A'; 
            }
            else s += 'Y'; 
        }
        if(s[0] == 'Y'){
            tmp = press(s + 'B' + s + "AA" + s + "AX" + s + "AB"); 
            if(tmp == s.length() + 1){
                s += 'B'; 
            }
            else if(tmp == s.length() + 2){
                s += 'A'; 
            }
            else s += 'X'; 
        }
        if(s[0] == 'A'){
            tmp = press(s + 'B' + s + "XY" + s + "XX" + s + "XB"); 
            if(tmp == s.length() + 1){
                s += 'B'; 
            }
            else if(tmp == s.length() + 2){
                s += 'X'; 
            }
            else s += 'Y'; 
        }
        if(s[0] == 'B'){
            tmp = press(s + 'A' + s + "XY" + s + "XX" + s + "XA"); 
            if(tmp == s.length() + 1){
                s += 'A'; 
            }
            else if(tmp == s.length() + 2){
                s += 'X'; 
            }
            else s += 'Y'; 
        }
        if(s.length() == n - 1){
            break; 
        }
    }
    tmp = press(s + "AB"); 
    if(tmp >= n){
        tmp = press(s + 'A'); 
        if(tmp == n){
            s += 'A'; 
        }
        else s += 'B'; 
    }
    else{
        tmp = press(s + 'X'); 
        if(tmp == n){
            s += 'X'; 
        }
        else s += 'Y'; 
    }
    return s; 
}

// signed main(){
//     ios_base::sync_with_stdio(false); 
//     cin.tie(NULL); 
     
// }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:15: error: 'press' was not declared in this scope
   11 |     int tmp = press("AB");
      |               ^~~~~
combo.cpp:29:20: 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(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:32:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             if(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:42:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:49:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             if(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:52:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:59:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |             if(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:62:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:67:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   67 |         if(s.length() == n - 1){
      |            ~~~~~~~~~~~^~~~~~~~