Submission #1118229

#TimeUsernameProblemLanguageResultExecution timeMemory
1118229vjudge1Kangaroo (CEOI16_kangaroo)C++17
100 / 100
39 ms31832 KiB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define inf 0x3F3F3F3F3F3F3F3F

const int MXN = 2e3 + 5;
const int mod = 1e9 + 7;

int dp[MXN][MXN];
void _()
{
  int n, x, y;
  cin >> n >> x >> y;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n; j++)
    {
      if (i == x || i == y)
      {
        dp[i][j] += dp[i - 1][j - 1];
        dp[i][j] += dp[i - 1][j];
        dp[i][j] % mod;
      }
      else
      {
        int cnt = j;
        dp[i][j] += (dp[i - 1][j + 1] * cnt) % mod;
        cnt = j - (i - 1 >= x) - (i - 1 >= y);
        dp[i][j] += (dp[i - 1][j - 1] * cnt) % mod;
        dp[i][j] % mod;
      }
    }
  }
  cout << dp[n][1] << '\n';
}

signed main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  // cin >> t;
  while (t--) _();
}

Compilation message (stderr)

kangaroo.cpp: In function 'void _()':
kangaroo.cpp:25:18: warning: statement has no effect [-Wunused-value]
   25 |         dp[i][j] % mod;
      |         ~~~~~~~~~^~~~~
kangaroo.cpp:33:18: warning: statement has no effect [-Wunused-value]
   33 |         dp[i][j] % mod;
      |         ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...