Submission #1083063

#TimeUsernameProblemLanguageResultExecution timeMemory
1083063KasymKCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} string guess_sequence(int n){ string tm = "ABXY"; vector<char> use; string ans = ""; if(press("AB")){ if(press("A")){ for(int i = 1; i <= 3; ++i) use.pb(tm[i]); ans += "A"; } else{ use.pb("A"); for(int i = 2; i <= 3; ++i) use.pb(tm[i]); ans += "B"; } } else{ if(press("X")){ for(int i = 0; i <= 1; ++i) use.pb(tm[i]); use.pb("Y"); ans += "X"; } else{ for(int i = 0; i <= 2; ++i) use.pb(tm[i]); ans += "Y"; } } assert((int)use.size() == 3); if(n == 1) return ans; int x = 0; for(int i = 0; i < n-2; ++i){ int s = (int)ans.size(); x = press(ans+use[0]+ans+use[1]+use[0]+ans+use[1]+use[1]+ans+use[1]+use[2]); if(x == s+1) ans += use[0]; else if(x == s+2) ans += use[1]; else ans += use[2]; } if(press(ans+use[0]) == n) ans += use[0]; else if(press(ans+use[1]) == n) ans += use[1]; else ans += use[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:23: error: no matching function for call to 'push_back(const char [2])'
   28 |             use.pb("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:28:20: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
   28 |             use.pb("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:28:20: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
   28 |             use.pb("A");
      |                    ^~~
      |                    |
      |                    const char*
combo.cpp:38:23: error: no matching function for call to 'push_back(const char [2])'
   38 |             use.pb("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:38:20: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
   38 |             use.pb("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:38:20: error: invalid conversion from 'const char*' to 'std::vector<char>::value_type' {aka 'char'} [-fpermissive]
   38 |             use.pb("Y");
      |                    ^~~
      |                    |
      |                    const char*