# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600575 | enerelt14 | Combo (IOI18_combo) | C++17 | 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 "combo.h"
#include<bits/stdc++.h>
using namespace std;
int n;
string guess_sequence(int N){
string ans;
n=N;
string p;
string x;
for (int i=0;i<n;i++){
if (i==0){
p+='A';
for (int i=1;i<4*n;i++)p+='B';
if (press(p)>0){
p.clear();
for (int i=0;i<4*n;i++)p+='A';
if (press(p)>0){
ans+='A';
x={BXY};
}
else{
ans+='B';
x={AXY};
}
p.clear();
continue;
}
p.clear();
for (int i=0;i<4*n;i++)p+='X';
if (press(p)>0){
ans+='X';
x={ABY};
}
else{
ans+='Y';
x={ABX};
}
p.clear();
continue;
}
if (i==n-1){
p+=ans;
for (int i=ans.size();i<4*n;i++)p+=x[0];
if (press(p)){
ans+=x[0];
return ans;
}
p.clear();
p+=ans;
for (int i=ans.size();i<4*n;i++)p+=x[1];
if (press(p)){
ans+=x[1];
return ans;
}
ans+=x[2];
return ans;
}
for (int i=0;i<4;i++){
p+=ans;
if (i==0){
p+=x[0];
for (int i=ans.size()+1;i<n;i++)p+=ans[0];
continue;
}
p+=x[1];
p+=x[i-1];
for (int i=ans.size()+2;i<n;i++)p+=ans[0];
}
y=press(p);
if (y==ans.size())ans+=x[2];
if (y==ans.size()+1)ans+=x[0];
if (y==ans.size()+2)ans+=x[1];
}
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)': combo.cpp:19:24: error: 'BXY' was not declared in this scope 19 | x={BXY}; | ^~~ combo.cpp:19:27: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<brace-enclosed initializer list>') 19 | x={BXY}; | ^ In file included from /usr/include/c++/10/string:55, from combo.h:3, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:665:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 665 | operator=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:665:37: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::__cxx11::basic_string<char>&' 665 | operator=(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:675:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 675 | operator=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:675:31: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const char*' 675 | operator=(const _CharT* __s) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:686:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 686 | operator=(_CharT __c) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:686:24: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'char' 686 | operator=(_CharT __c) | ~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:703:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 703 | operator=(basic_string&& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:703:32: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::__cxx11::basic_string<char>&&' 703 | operator=(basic_string&& __str) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:766:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 766 | operator=(initializer_list<_CharT> __l) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:766:42: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<char>' 766 | operator=(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _Tp = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 780 | operator=(const _Tp& __svt) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: template argument deduction/substitution failed: combo.cpp:19:27: note: couldn't deduce template parameter '_Tp' 19 | x={BXY}; | ^ combo.cpp:23:24: error: 'AXY' was not declared in this scope 23 | x={AXY}; | ^~~ combo.cpp:23:27: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<brace-enclosed initializer list>') 23 | x={AXY}; | ^ In file included from /usr/include/c++/10/string:55, from combo.h:3, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:665:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 665 | operator=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:665:37: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::__cxx11::basic_string<char>&' 665 | operator=(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:675:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 675 | operator=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:675:31: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const char*' 675 | operator=(const _CharT* __s) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:686:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 686 | operator=(_CharT __c) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:686:24: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'char' 686 | operator=(_CharT __c) | ~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:703:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 703 | operator=(basic_string&& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:703:32: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::__cxx11::basic_string<char>&&' 703 | operator=(basic_string&& __str) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:766:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 766 | operator=(initializer_list<_CharT> __l) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:766:42: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<char>' 766 | operator=(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _Tp = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 780 | operator=(const _Tp& __svt) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: template argument deduction/substitution failed: combo.cpp:23:27: note: couldn't deduce template parameter '_Tp' 23 | x={AXY}; | ^ combo.cpp:32:20: error: 'ABY' was not declared in this scope 32 | x={ABY}; | ^~~ combo.cpp:32:23: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<brace-enclosed initializer list>') 32 | x={ABY}; | ^ In file included from /usr/include/c++/10/string:55, from combo.h:3, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:665:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 665 | operator=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:665:37: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::__cxx11::basic_string<char>&' 665 | operator=(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:675:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 675 | operator=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:675:31: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const char*' 675 | operator=(const _CharT* __s) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:686:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 686 | operator=(_CharT __c) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:686:24: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'char' 686 | operator=(_CharT __c) | ~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:703:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 703 | operator=(basic_string&& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:703:32: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::__cxx11::basic_string<char>&&' 703 | operator=(basic_string&& __str) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:766:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 766 | operator=(initializer_list<_CharT> __l) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:766:42: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<char>' 766 | operator=(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _Tp = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 780 | operator=(const _Tp& __svt) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: template argument deduction/substitution failed: combo.cpp:32:23: note: couldn't deduce template parameter '_Tp' 32 | x={ABY}; | ^ combo.cpp:36:20: error: 'ABX' was not declared in this scope 36 | x={ABX}; | ^~~ combo.cpp:36:23: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<brace-enclosed initializer list>') 36 | x={ABX}; | ^ In file included from /usr/include/c++/10/string:55, from combo.h:3, from combo.cpp:1: /usr/include/c++/10/bits/basic_string.h:665:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 665 | operator=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:665:37: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::__cxx11::basic_string<char>&' 665 | operator=(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:675:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 675 | operator=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:675:31: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const char*' 675 | operator=(const _CharT* __s) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:686:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 686 | operator=(_CharT __c) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:686:24: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'char' 686 | operator=(_CharT __c) | ~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:703:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 703 | operator=(basic_string&& __str) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:703:32: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::__cxx11::basic_string<char>&&' 703 | operator=(basic_string&& __str) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:766:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 766 | operator=(initializer_list<_CharT> __l) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:766:42: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<char>' 766 | operator=(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _Tp = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 780 | operator=(const _Tp& __svt) | ^~~~~~~~ /usr/include/c++/10/bits/basic_string.h:780:8: note: template argument deduction/substitution failed: combo.cpp:36:23: note: couldn't deduce template parameter '_Tp' 36 | x={ABX}; | ^ combo.cpp:69:9: error: 'y' was not declared in this scope 69 | y=press(p); | ^ combo.cpp:8:12: warning: control reaches end of non-void function [-Wreturn-type] 8 | string p; | ^