Submission #1293834

#TimeUsernameProblemLanguageResultExecution timeMemory
1293834darkdevilvaqifKangaroo (CEOI16_kangaroo)C++20
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") #pragma GCC optimize ("unroll-loops") // #pragma GCC target("avx2") #include <bits/stdc++.h> #define ll long long #define ull unsigned ll #define ld long double #define all(v, l) v.begin() + l, v.end() #define rall(v, l) v.rbegin(), v.rend() - l #define pb push_back #define pf push_front #define rsz resize #define fi first #define se second #define LMAX LLONG_MAX #define LMIN LLONG_MIN #define IMAX INT_MAX #define IMIN INT_MIN #define endl "\n" #define newline cout << endl; using namespace std; // structs // globals // variables int n; // iterators int i; // notes /* -stuff you should look for- * int overflow, array bounds * special cases (n=1?) * do something instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH continue - skip the rest in the loop */ // functions ll GCD(ll numeroune, ll numerodeux); ll LCM(ll numeroune, ll numerodeux); ll power(ll numeroune, ll numerodeux); void solve() { cin >> n >> s >> e; ans = 0; vector <bool> used(n + 1, false); used[s] = true; function <void(int, int, int)> f = [&](int eaten, int v, int par) { if (eaten == n) { if (v == e) { ans++; ans %= MOD; } return; } if (par < v) { for (int u = 1; u < v; u++) { if (used[u]) { continue; } used[u] = true; f(eaten + 1, u, v); used[u] = false; } } else { for (int u = v + 1; u <= n; u++) { if (used[u]) { continue; } used[u] = true; f(eaten + 1, u, v); used[u] = false; } } }; for (i = s + 1; i <= n; i++) { used[i] = true; f(2, i, s); used[i] = false; } for (i = 1; i < s; i++) { used[i] = true; f(2, i, s); used[i] = false; } cout << ans - 1; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; cin >> t; while (t--) { solve(); newline } } ll GCD(ll numeroune, ll numerodeux) { if (!numeroune) { return numerodeux; } return GCD(numerodeux % numeroune, numeroune); } ll LCM(ll numeroune, ll numerodeux) { return numeroune * numerodeux / GCD(numeroune, numerodeux); } ll power(ll numeroune, ll numerodeux) { ll res = 1; while (numerodeux) { if (numerodeux & 1) { res *= numeroune; } numeroune *= numeroune; numerodeux >>= 1; } return res; } /* $$$$$$$$\ $$$$$$$$\ $$ _____|\____$$ | $$ | $$ / $$$$$\ $$ / $$ __| $$ / $$ | $$ / $$$$$$$$\ $$$$$$$$\ \________|\________| */

Compilation message (stderr)

kangaroo.cpp: In function 'void solve()':
kangaroo.cpp:52:17: error: 's' was not declared in this scope
   52 |     cin >> n >> s >> e;
      |                 ^
kangaroo.cpp:52:22: error: 'e' was not declared in this scope; did you mean 'std::numbers::e'?
   52 |     cin >> n >> s >> e;
      |                      ^
      |                      std::numbers::e
In file included from /usr/include/c++/13/bits/max_size_type.h:37,
                 from /usr/include/c++/13/bits/ranges_base.h:39,
                 from /usr/include/c++/13/bits/ranges_algobase.h:38,
                 from /usr/include/c++/13/bits/ranges_algo.h:38,
                 from /usr/include/c++/13/algorithm:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from kangaroo.cpp:4:
/usr/include/c++/13/numbers:122:27: note: 'std::numbers::e' declared here
  122 |   inline constexpr double e = e_v<double>;
      |                           ^
kangaroo.cpp:54:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |     ans = 0;
      |     ^~~
      |     abs
kangaroo.cpp: In lambda function:
kangaroo.cpp:65:24: error: 'MOD' was not declared in this scope
   65 |                 ans %= MOD;
      |                        ^~~