Submission #103842

#TimeUsernameProblemLanguageResultExecution timeMemory
103842aviroop123Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "combo.h" // #include "ext/pb_ds/assoc_container.hpp" // #include "ext/pb_ds/tree_policy.hpp" // using namespace __gnu_pbds; using namespace std; typedef long long int ll; // #define int long long #define pb push_back #define fi first #define se second #define fr(i, a, b) for(int i = a; i <= b; i++) #define all(x) x.begin(), x.end() #define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0) #define pii pair<int,int> #define sz(x) (int)x.size() const int mod = 998244353; const int mod1 = 998244353; typedef long double f80; #ifndef LOCAL #pragma GCC optimize ("Ofast") #define endl '\n' #endif // template<typename T> // using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l, int r){ uniform_int_distribution<int> uid(l, r); return uid(rng); } ll pwr(ll a,ll b){ a %= mod; int ans = 1; while(b){ if(b & 1) ans = (ans * a) % mod; a = (a * a) % mod; b >>= 1; } return ans; } string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif string guess_sequence(int n){ string s = ""; if(press("AB")){ if(press("A")) s += 'A'; else s += 'B'; } else{ if(press("X")){ s += 'X'; } else{ s += 'Y'; } } vector<char> v; if(s[0] != 'A'){ v.pb('A'); } if(s[0] != 'B'){ v.pb('B'); } if(s[0] != 'X'){ v.pb('X'); } if(s[0] != 'Y'){ v.pb('Y'); } for(int i = 2; i < n; i++){ string ss = s; ss += v[0]; ss += v[0]; ss += s; ss += v[0]; ss += v[1]; ss += s; ss += v[0]; ss += v[2]; ss += s; ss += v[1]; int val = press(ss); if(val == sz(s)){ s += v[2]; } else if(val == sz(s) + 1){ s += v[1]; } else{ s += v[0]; } } string ss = s + to_string(v[0]) + to_string(v[1]); if(press(ss) == sz(s) + 1){ ss = s + to_string(v[0]); if(press(ss) == sz(s) + 1) s += v[0]; else s += v[1]; } else s += v[2]; return s; }

Compilation message (stderr)

combo.cpp: In instantiation of 'std::string to_string(A) [with A = char; std::string = std::__cxx11::basic_string<char>]':
combo.cpp:143:32:   required from here
combo.cpp:66:3: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   66 |   for (const auto &x : v) {
      |   ^~~
      |   std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from combo.cpp:1:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
combo.cpp:66:3: error: 'end' was not declared in this scope; did you mean 'std::end'?
   66 |   for (const auto &x : v) {
      |   ^~~
      |   std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from combo.cpp:1:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~