# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
787180 | resolve100 | 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>
#include "combo.h"
#define ll long long
#define ull unsigned ll
#define pb push_back
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define read_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
using namespace std;
char chars[] = {'A', 'B', 'X', 'Y'};
string guess_sequence(int N){
string out;
int no;
for (int i = 0; i < 3; i++){
int num = press(chars[i]);
if (num){
out.append(chars[i]);
no = i;
break;
}
}
if (out.size() == 0) out.pb(chars[3]);
for (int i = 1; i < N; i++){
if (no == 3){
for (int j = 2; j > 1; j--){
int num = press(out+chars[j]);
if (num == i+1){
out.append(chars[j]);
break;
}
}
if (out.size() == i) out.append(arr[0]);
}
else{
for (int j = 0; j < 3; j++){
if (i == j) continue;
int num = press(out+chars[i]);
if (num == i+1){
out.append(chars[i]);
break;
}
}
if (out.size() == i) out.append(arr[3]);
}
}
return out;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)': combo.cpp:19:26: error: could not convert 'chars[i]' from 'char' to 'std::string' {aka 'std::__cxx11::basic_string<char>'} 19 | int num = press(chars[i]); | ~~~~~~~^ | | | char combo.cpp:21:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char&)' 21 | out.append(chars[i]); | ^ 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:1234:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match) 1234 | append(const _CharT* __s) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1234:7: note: conversion of argument 1 would be ill-formed: combo.cpp:21:22: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 21 | out.append(chars[i]); | ~~~~~~~^ | | | char 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:1192:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1192 | append(const basic_string& __str) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1192:34: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&' 1192 | append(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:1209:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(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]' 1209 | append(const basic_string& __str, size_type __pos, size_type __n = npos) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1209:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1221:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, 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]' 1221 | append(const _CharT* __s, size_type __n) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1221:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1251:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' 1251 | append(size_type __n, _CharT __c) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1251:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1261:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1261 | append(initializer_list<_CharT> __l) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1261:39: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>' 1261 | append(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:1280:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1280 | append(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1280:9: note: template argument deduction/substitution failed: combo.cpp:21:23: note: candidate expects 2 arguments, 1 provided 21 | out.append(chars[i]); | ^ combo.cpp:33:25: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char&)' 33 | out.append(chars[j]); | ^ 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:1234:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match) 1234 | append(const _CharT* __s) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1234:7: note: conversion of argument 1 would be ill-formed: combo.cpp:33:24: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 33 | out.append(chars[j]); | ~~~~~~~^ | | | char 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:1192:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1192 | append(const basic_string& __str) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1192:34: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&' 1192 | append(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:1209:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(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]' 1209 | append(const basic_string& __str, size_type __pos, size_type __n = npos) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1209:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1221:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, 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]' 1221 | append(const _CharT* __s, size_type __n) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1221:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1251:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' 1251 | append(size_type __n, _CharT __c) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1251:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1261:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1261 | append(initializer_list<_CharT> __l) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1261:39: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>' 1261 | append(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:1280:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1280 | append(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1280:9: note: template argument deduction/substitution failed: combo.cpp:33:25: note: candidate expects 2 arguments, 1 provided 33 | out.append(chars[j]); | ^ combo.cpp:37:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 37 | if (out.size() == i) out.append(arr[0]); | ~~~~~~~~~~~^~~~ combo.cpp:37:36: error: 'arr' was not declared in this scope 37 | if (out.size() == i) out.append(arr[0]); | ^~~ combo.cpp:44:25: error: no matching function for call to 'std::__cxx11::basic_string<char>::append(char&)' 44 | out.append(chars[i]); | ^ 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:1234:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match) 1234 | append(const _CharT* __s) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1234:7: note: conversion of argument 1 would be ill-formed: combo.cpp:44:24: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 44 | out.append(chars[i]); | ~~~~~~~^ | | | char 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:1192:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1192 | append(const basic_string& __str) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1192:34: note: no known conversion for argument 1 from 'char' to 'const std::__cxx11::basic_string<char>&' 1192 | append(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/10/bits/basic_string.h:1209:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(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]' 1209 | append(const basic_string& __str, size_type __pos, size_type __n = npos) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1209:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1221:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(const _CharT*, 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]' 1221 | append(const _CharT* __s, size_type __n) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1221:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1251:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' 1251 | append(size_type __n, _CharT __c) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1251:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/10/bits/basic_string.h:1261:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1261 | append(initializer_list<_CharT> __l) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1261:39: note: no known conversion for argument 1 from 'char' to 'std::initializer_list<char>' 1261 | append(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/basic_string.h:1280:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::append(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1280 | append(_InputIterator __first, _InputIterator __last) | ^~~~~~ /usr/include/c++/10/bits/basic_string.h:1280:9: note: template argument deduction/substitution failed: combo.cpp:44:25: note: candidate expects 2 arguments, 1 provided 44 | out.append(chars[i]); | ^ combo.cpp:48:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 48 | if (out.size() == i) out.append(arr[3]); | ~~~~~~~~~~~^~~~ combo.cpp:48:36: error: 'arr' was not declared in this scope 48 | if (out.size() == i) out.append(arr[3]); | ^~~