Submission #1161923

#TimeUsernameProblemLanguageResultExecution timeMemory
1161923tsengangCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
const int mod = 998244353;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
string guess_sequence(int n){
    string s = "";
    string chr = "ABXY";
    if(press("AB") > 0){
        if(press("A") > 0){
            s+="A";
            chr.erase("A");
        }
        else{
            s+="B";
            chr.erase("B");
        }
    }
    else{
        if(press("X") > 0){
            s+="X";
            chr.erase("X");
        }
        else{
            s+='Y';
            chr.erase("Y");
        }
    }
    for(int i = 2; i <= n-1; i++){
        string t = s+chr[0]+s+chr[1]+chr[0]+s+chr[1]+chr[2]+s+chr[1]+chr[1];
        int x = press(t);
        if(x == i){
            s+=chr[0];
        }
        else{
            if(x == i+1){
                s+=chr[1];
            }
            else s+=chr[2];
        }
    }
    if(press(s+chr[0]) == n)
        s+=chr[0];
    else{
        if(press(s+chr[1]) == n)
            s+=chr[1];
        else s+=chr[2];
    }
    ertunt s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:23: error: invalid conversion from 'const char*' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-fpermissive]
   20 |             chr.erase("A");
      |                       ^~~
      |                       |
      |                       const char*
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/11/bits/basic_string.h:1827:23: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 1827 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
combo.cpp:24:23: error: invalid conversion from 'const char*' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-fpermissive]
   24 |             chr.erase("B");
      |                       ^~~
      |                       |
      |                       const char*
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/11/bits/basic_string.h:1827:23: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 1827 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
combo.cpp:30:23: error: invalid conversion from 'const char*' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-fpermissive]
   30 |             chr.erase("X");
      |                       ^~~
      |                       |
      |                       const char*
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/11/bits/basic_string.h:1827:23: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 1827 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
combo.cpp:34:23: error: invalid conversion from 'const char*' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-fpermissive]
   34 |             chr.erase("Y");
      |                       ^~~
      |                       |
      |                       const char*
In file included from /usr/include/c++/11/string:55,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/11/bits/basic_string.h:1827:23: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 1827 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~