Submission #1088706

#TimeUsernameProblemLanguageResultExecution timeMemory
1088706SunbaeKangaroo (CEOI16_kangaroo)C++17
100 / 100
33 ms31680 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; const ll mod = 1e9 + 7; ll dp[2001][2001]; signed main(){ int n, s, e; scanf("%d %d %d", &n, &s, &e); dp[1][1] = 1; for(int i = 2; i<=n; ++i){ for(int j = 1; j<=n; ++j){ if(i == s || i == e){ dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % mod; }else{ dp[i][j] = (dp[i][j] + (dp[i-1][j+1] * j) % mod ) % mod; dp[i][j] = (dp[i][j] + (dp[i-1][j-1] * max((j-(s<i)-(e<i)), 0)) % mod ) % mod; } } } printf("%lld", dp[n][1]); }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:7:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  int n, s, e; scanf("%d %d %d", &n, &s, &e);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...