Submission #975491

#TimeUsernameProblemLanguageResultExecution timeMemory
975491duckindogKangaroo (CEOI16_kangaroo)C++17
6 / 100
7 ms31904 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 2'000 + 10, M = 1'000'000'007; int n, st, ed; struct modint { int value; modint(int x = 0) : value(x) {} modint operator + (const modint& rhs) { return (value + rhs.value) % M; } modint operator - (const modint& rhs) { return ((value - rhs.value) % M + M) % M; } modint operator * (const modint& rhs) { return 1ll * value * rhs.value % M; } modint operator += (const modint& rhs) { value = (value + rhs.value) % M; return *this; } modint operator -= (const modint& rhs) { value = ((value - rhs.value) % M + M) % M; return *this; } modint operator *= (const modint& rhs) { value = 1ll * value * rhs.value % M; return *this; } friend ostream& operator << (ostream& os, const auto& rhs) { return os << rhs.value; } } f[N][N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> st >> ed; f[1][1] = 1; for (int i = 2; i <= n; ++i) { for (int j = 1; j <= i; ++j) { auto& ret = f[i][j]; if (i == st || i == ed) ret = f[i - 1][j] + f[i][j - 1]; else ret = f[i - 1][j + 1] * j + f[i - 1][j - 1] * (j - (i > st) - (i > ed)); } } cout << f[n][1] << "\n"; }

Compilation message (stderr)

kangaroo.cpp:24:51: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 |   friend ostream& operator << (ostream& os, const auto& rhs) { return os << rhs.value; }
      |                                                   ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...