# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
395313 | grt | 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 <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
string guess_sequence(int n) {
char firstLet = 'x';
if(press("AX") > 0) {
if(press("A")) firstLet = 'A';
else firstLet = 'X';
} else {
if(press("B")) firstLet = 'B';
else firstLet = 'Y';
}
string cur = (string)firstLet;
//4 * n -> s + 'B', s + 'X' + 'A'
for(int i = 1; i < n; ++i) {
int id = 0;
string s = "";
for(auto let : {'A', 'B', 'X', 'Y'}) {
if(let == firstLet) continue;
if(id == 0) {
s += cur + let;
} else if(id == 1) {
for(auto let2 : {'A', 'B', 'X', 'Y'}) {
if(let2 == firstLet) continue;
s += cur + let + let2;
}
}
id++;
}
int w = press(s);
int id = 0;
for(auto let : {'A', 'B', 'X', 'Y'}) {
if(w == i) {
if(id == 2) cur += let;
} else if(w == i + 1) {
if(id == 0) cur += let;
} else {
if(id == 1) cur += let;
}
}
}
return cur;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)': combo.cpp:16:5: error: 'press' was not declared in this scope 16 | if(press("AX") > 0) { | ^~~~~ combo.cpp:23:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(char&)' 23 | string cur = (string)firstLet; | ^~~~~~~~ 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:650:2: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 650 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:650:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/bits/move.h:57, from /usr/include/c++/10/bits/stl_pair.h:59, from /usr/include/c++/10/bits/stl_algobase.h:64, from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from combo.cpp:1: /usr/include/c++/10/type_traits: In substitution of 'template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/10/bits/basic_string.h:117:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using _If_sv = std::enable_if_t<std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value, _Res> [with _Tp = char; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' /usr/include/c++/10/bits/basic_string.h:648:30: required from here /usr/include/c++/10/type_traits:2554:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2554 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ 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:639:2: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 639 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:639:2: note: template argument deduction/substitution failed: combo.cpp:23:23: note: candidate expects 4 arguments, 1 provided 23 | string cur = (string)firstLet; | ^~~~~~~~ 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:625:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 625 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:625:9: note: template argument deduction/substitution failed: combo.cpp:23:23: note: candidate expects 3 arguments, 1 provided 23 | string cur = (string)firstLet; | ^~~~~~~~ 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:587:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 587 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:587:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:583:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 583 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:583:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:579:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 579 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:579:45: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>' 579 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:552:35: note: no known conversion for argument 1 from 'char' to 'std::__cxx11::basic_string<char>&&' 552 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:540:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT, const _Alloc&) [with <template-parameter-2-1> = <template-parameter-1-1>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:540:7: note: template argument deduction/substitution failed: combo.cpp:23:23: note: candidate expects 3 arguments, 1 provided 23 | string cur = (string)firstLet; | ^~~~~~~~ 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:525:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with <template-parameter-2-1> = <template-parameter-1-1>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 525 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:525:7: note: template argument deduction/substitution failed: combo.cpp:23:23: note: cannot convert 'firstLet' (type 'char') to type 'const char*' 23 | string cur = (string)firstLet; | ^~~~~~~~ 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:510:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' 510 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:510:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:492:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' 492 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:492:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:476:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, 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]' 476 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:476:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:461:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' 461 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:461:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:448:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 448 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:448:40: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&' 448 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:440:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 440 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:440:34: note: no known conversion for argument 1 from 'char' to 'const std::allocator<char>&' 440 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:431:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 431 | basic_string() | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:431:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:145:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::__sv_wrapper, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 145 | basic_string(__sv_wrapper __svw, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/10/bits/basic_string.h:145:7: note: candidate expects 2 arguments, 1 provided combo.cpp:40:11: error: 'press' was not declared in this scope 40 | int w = press(s); | ^~~~~ combo.cpp:41:7: error: redeclaration of 'int id' 41 | int id = 0; | ^~ combo.cpp:26:7: note: 'int id' previously declared here 26 | int id = 0; | ^~