# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
719414 | AndrijaM | Combo (IOI18_combo) | C++14 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
string guess_sequence(int n)
{
vector<string>v;
v.push_back("A");
v.push_back("B");
v.push_back("X");
v.push_back("Y");
string ans="";
bool ok=false;
string c="";
if(!ok && press("A"))
{
ok=true;
v.erase(v.begin()+0);
c="A";
ans+='A';
}
if(!ok && press("B"))
{
ok=true;
v.erase(v.begin()+1);
c="B";
ans+='B';
}
if(!ok && press("X"))
{
ok=true;
c="X";
v.erase(v.begin()+2);
ans+='X';
}
if(!ok && press("Y"))
{
ok=true;
c="Y";
v.erase(v.begin()+3);
ans+='Y';
}
int k=1;
while(true)
{
string nstr=ans+v[0]+c+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2];
if(nstr<=4*n)
{
int kol=press(nstr);
if(kol==k)
{
ans+=v[2];
}
else if(kol==k+1)
{
ans+=v[0];
}
else if(kol==k+2)
{
ans+=v[1];
}
}
else
{
if(press(ans+v[0])==n)
{
ans+=v[0];
}
if(press(ans+v[1])==n)
{
ans+=v[1];
}
if(press(ans+v[2])==n)
{
ans+=v[2];
}
}
}
return ans;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)': combo.cpp:18:15: error: 'press' was not declared in this scope 18 | if(!ok && press("A")) | ^~~~~ combo.cpp:25:15: error: 'press' was not declared in this scope 25 | if(!ok && press("B")) | ^~~~~ combo.cpp:32:15: error: 'press' was not declared in this scope 32 | if(!ok && press("X")) | ^~~~~ combo.cpp:39:15: error: 'press' was not declared in this scope 39 | if(!ok && press("Y")) | ^~~~~ combo.cpp:50:16: error: no match for 'operator<=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 50 | if(nstr<=4*n) | ~~~~^~~~~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1086:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)' 1086 | operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1086:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1192:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<=(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)' 1192 | operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1192:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1285:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1285 | operator<=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1285:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1359:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)' 1359 | operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1359:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1453:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1453 | operator<=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1453:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1531:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)' 1531 | operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1531:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/regex:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110, from combo.cpp:1: /usr/include/c++/10/bits/regex.h:1631:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1631 | operator<=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/regex.h:1631:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/stl_pair.h:508:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)' 508 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:508:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:384:5: note: candidate: 'template<class _Iterator> bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)' 384 | operator<=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:384:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:422:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)' 422 | operator<=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:422:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:1460:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)' 1460 | operator<=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1460:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/bits/char_traits.h:39, from /usr/include/c++/10/ios:40, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:1513:5: note: candidate: 'template<class _Iterator> bool std::operator<=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)' 1513 | operator<=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1513:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:6343:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)' 6343 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:6343:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:6356:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)' 6356 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:6356:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: mismatched types 'const _CharT*' and 'int' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/string:55, from /usr/include/c++/10/bits/locale_classes.h:40, from /usr/include/c++/10/bits/ios_base.h:41, from /usr/include/c++/10/ios:42, from /usr/include/c++/10/istream:38, from /usr/include/c++/10/sstream:38, from /usr/include/c++/10/complex:45, from /usr/include/c++/10/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:6368:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)' 6368 | operator<=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:6368:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/deque:67, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:68, from combo.cpp:1: /usr/include/c++/10/bits/stl_deque.h:2298:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<=(const std::deque<_Tp, _Alloc>&, const std::deque<_Tp, _Alloc>&)' 2298 | operator<=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_deque.h:2298:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::deque<_Tp, _Alloc>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/tuple:39, from /usr/include/c++/10/functional:54, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71, from combo.cpp:1: /usr/include/c++/10/array:299:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator<=(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)' 299 | operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) | ^~~~~~~~ /usr/include/c++/10/array:299:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::array<_Tp, _Nm>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/functional:54, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:71, from combo.cpp:1: /usr/include/c++/10/tuple:1460:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<=(const std::tuple<_Tps ...>&, const std::tuple<_Elements ...>&)' 1460 | operator<=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/10/tuple:1460:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_Tps ...>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/locale_conv.h:41, from /usr/include/c++/10/locale:43, from /usr/include/c++/10/iomanip:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from combo.cpp:1: /usr/include/c++/10/bits/unique_ptr.h:826:5: note: candidate: 'template<class _Tp, class _Dp, class _Up, class _Ep> bool std::operator<=(const std::unique_ptr<_Tp, _Dp>&, const std::unique_ptr<_Up, _Ep>&)' 826 | operator<=(const unique_ptr<_Tp, _Dp>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/unique_ptr.h:826:5: note: template argument deduction/substitution failed: combo.cpp:50:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::unique_ptr<_Tp, _Dp>' 50 | if(nstr<=4*n) | ^ In file included from /usr/include/c++/10/bits/locale_conv.h:41, from /usr/include/c++/10/locale:43, from /usr/include/c++/10/iomanip:43, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:72, from combo.cpp:1: /usr/include/c++/10/bits/unique_ptr.h:833:5: note: candidate: 'template<class _Tp, class _Dp> bool std::operator<=(const std::un