Submission #120125

#TimeUsernameProblemLanguageResultExecution timeMemory
120125arman_ferdousAsceticism (JOI18_asceticism)C++17
49 / 100
134 ms150904 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 3e3+100; const int MOD = 1e9+7; ll dp[N][N]; ll DP(int n, int k) { if(k > n) return 0; if(k == 1 || k == n || n == 1) return 1; if(dp[n][k] != -1) return dp[n][k]; dp[n][k] = ((ll)(n - k + 1) * DP(n - 1, k - 1) % MOD) + ((ll)k * DP(n - 1, k) % MOD); if(dp[n][k] >= MOD) dp[n][k] -= MOD; return dp[n][k]; } int main() { memset(dp, -1, sizeof dp); int n, k; scanf("%d %d", &n, &k); printf("%lld", DP(n, k)); return 0; }

Compilation message (stderr)

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