Submission #1272779

#TimeUsernameProblemLanguageResultExecution timeMemory
1272779gazizmadi11Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" // #define pb push_back // #define pf push_front // #define F first // #define S second // #define all(v) v.begin(),v.end() // #define pii pair<int,int> // #define tm (tl+tr)/2 // #define TL v+v, tl, tm // #define TR v+v+1, tm+1, tr // #define DA l <= tl && tr <= r // #define NE r < tl || tr < l // #define double long double // #define int long long using namespace std; // // const int N=2e5+7; // const int mod=998244353; // const int inf=2e9; string guess_sequence(int N){ string s=""; for(int i=1; i <= 3; i++){ for(int j=1; j <= 4; j++){ if(j==1)s+="A"; else if(j==2)s+="B"; else if(j==3)s+="X"; else if(j==4)s+="Y"; int x=press(s); if(x==i)break; s.erase(s.rbegin()); } } return s; } // void solve(){ // } // signed main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); // int t=1; // cin >> t; // while(t--)solve(); // return 0; // }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:20: error: no matching function for call to 'std::__cxx11::basic_string<char>::erase(std::__cxx11::basic_string<char>::reverse_iterator)'
   32 |             s.erase(s.rbegin());
      |             ~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/13/string:54,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from combo.cpp:1:
/usr/include/c++/13/bits/basic_string.h:2069:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2069 |       erase(size_type __pos = 0, size_type __n = npos)
      |       ^~~~~
/usr/include/c++/13/bits/basic_string.h:2069:23: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::reverse_iterator' {aka 'std::reverse_iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> > >'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 2069 |       erase(size_type __pos = 0, size_type __n = npos)
      |             ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:2089:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2089 |       erase(__const_iterator __position)
      |       ^~~~~
/usr/include/c++/13/bits/basic_string.h:2089:30: note:   no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::reverse_iterator' {aka 'std::reverse_iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> > >'} to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
 2089 |       erase(__const_iterator __position)
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:2109:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::erase(__const_iterator, __const_iterator) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2109 |       erase(__const_iterator __first, __const_iterator __last)
      |       ^~~~~
/usr/include/c++/13/bits/basic_string.h:2109:7: note:   candidate expects 2 arguments, 1 provided