| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 336589 | ljuba | 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>
#include "combo.h"
using namespace std;
string guess_sequence(int n) {
string ans;
if(guess("AB")) {
if(guess("A"))
ans += 'A';
else
ans += 'B';
} else if(guess("X")) {
ans += 'X';
} else {
ans += 'Y';
}
if(n <= 1)
return ans;
vector<char> kar;
if(ans != "A")
kar.push_back("A");
else if(ans != "B")
kar.push_back("B");
else if(ans != "X")
kar.push_back("X");
else if(ans != "Y");
kar.push_back("Y");
for(int i = 1; i < n-1; ++i) {
string s = ans + kar[0] + ans + kar[1] + kar[0] + ans + kar[1] + kar[1] + ans + kar[1] + kar[2];
int x = guess(s) - (i+1);
if(x == 0) {
ans += kar[2];
} else if(x == 1) {
ans += kar[0];
} else {
ans += kar[1];
}
}
if(guess(s+kar[0]) == n) {
ans += kar[0];
} else if(guess(s+kar[1]) == n) {
ans += kar[1];
} else {
ans += kar[2];
}
return ans;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:8: error: 'guess' was not declared in this scope
8 | if(guess("AB")) {
| ^~~~~
combo.cpp:23:26: error: no matching function for call to 'push_back(const char [2])'
23 | kar.push_back("A");
| ^
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1187 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:23:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
23 | kar.push_back("A");
| ^~~
| |
| const char*
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1203 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:23:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
23 | kar.push_back("A");
| ^~~
| |
| const char*
combo.cpp:25:26: error: no matching function for call to 'push_back(const char [2])'
25 | kar.push_back("B");
| ^
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1187 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:25:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
25 | kar.push_back("B");
| ^~~
| |
| const char*
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1203 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:25:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
25 | kar.push_back("B");
| ^~~
| |
| const char*
combo.cpp:27:26: error: no matching function for call to 'push_back(const char [2])'
27 | kar.push_back("X");
| ^
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1187 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:27:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
27 | kar.push_back("X");
| ^~~
| |
| const char*
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1203 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:27:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
27 | kar.push_back("X");
| ^~~
| |
| const char*
combo.cpp:28:10: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
28 | else if(ans != "Y");
| ^~
combo.cpp:29:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
29 | kar.push_back("Y");
| ^~~
combo.cpp:29:26: error: no matching function for call to 'push_back(const char [2])'
29 | kar.push_back("Y");
| ^
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1187 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:29:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
29 | kar.push_back("Y");
| ^~~
| |
| const char*
In file included from /usr/include/c++/10/vector:67,
from /usr/include/c++/10/functional:62,
from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/10/algorithm:74,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
from combo.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; std::vector<_Tp, _Alloc>::value_type = char]' (near match)
1203 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: conversion of argument 1 would be ill-formed:
combo.cpp:29:23: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
29 | kar.push_back("Y");
| ^~~
| |
| const char*
combo.cpp:33:17: error: 'guess' was not declared in this scope
33 | int x = guess(s) - (i+1);
| ^~~~~
combo.cpp:43:14: error: 's' was not declared in this scope
43 | if(guess(s+kar[0]) == n) {
| ^
combo.cpp:43:8: error: 'guess' was not declared in this scope
43 | if(guess(s+kar[0]) == n) {
| ^~~~~