Submission #1249218

#TimeUsernameProblemLanguageResultExecution timeMemory
1249218nguyn콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define ll long long #define F first #define S second #define pb push_back #define pii pair<int, int> const int N = 1e6; string guess_sequence(int N) { string res = ""; vector<char> c = {'A', 'B', 'X', 'Y'}; if (press("AB")) { if (press("A")) { res += "A"; } else res += "B"; } else { if (press("X")) { res += "X"; } else res += "Y"; } c.erase(find(c.begin(), c.end()), res[0]); for (int i = 1; i <= n - 2; i++) { string ask = res; ask.pb(c[2]); ask.pb(c[1]); ask = ask + res; ask.pb(c[2]); ask.pb(c[0]); ask = ask + res; ask.pb(c[2]); ask.pb(c[2]); ask = ask + res; ask.pb(c[1]); int x = press(ask); ans += c[x]; } if (press(ans + "A" + ans + "B") == N) { if (press(ans + "A") == N) { res += "A"; } else res += "B"; } else { if (press(ans + "X") == N) { res += "X"; } else { res += "Y"; } } }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:21: error: no matching function for call to 'find(std::vector<char>::iterator, std::vector<char>::iterator)'
   28 |         c.erase(find(c.begin(), c.end()), res[0]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3876:5: note: candidate: 'template<class _IIter, class _Tp> constexpr _IIter std::find(_IIter, _IIter, const _Tp&)'
 3876 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/11/bits/stl_algo.h:3876:5: note:   template argument deduction/substitution failed:
combo.cpp:28:21: note:   candidate expects 3 arguments, 2 provided
   28 |         c.erase(find(c.begin(), c.end()), res[0]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/locale_facets.h:48,
                 from /usr/include/c++/11/bits/basic_ios.h:37,
                 from /usr/include/c++/11/ios:44,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from combo.cpp:1:
/usr/include/c++/11/bits/streambuf_iterator.h:421:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >, const _CharT2&)'
  421 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/11/bits/streambuf_iterator.h:421:5: note:   template argument deduction/substitution failed:
combo.cpp:28:21: note:   '__gnu_cxx::__normal_iterator<char*, std::vector<char> >' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
   28 |         c.erase(find(c.begin(), c.end()), res[0]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from combo.cpp:1:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:60:1: note:   template argument deduction/substitution failed:
combo.cpp:28:21: note:   candidate expects 4 arguments, 2 provided
   28 |         c.erase(find(c.begin(), c.end()), res[0]);
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~
combo.cpp:29:30: error: 'n' was not declared in this scope
   29 |         for (int i = 1; i <= n - 2; i++) {
      |                              ^
combo.cpp:42:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |                 ans += c[x];
      |                 ^~~
      |                 abs
combo.cpp:44:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |         if (press(ans + "A" + ans + "B") == N) {
      |                   ^~~
      |                   abs
combo.cpp:58:1: warning: no return statement in function returning non-void [-Wreturn-type]
   58 | }
      | ^