Submission #120125

# Submission time Handle Problem Language Result Execution time Memory
120125 2019-06-23T13:38:02 Z arman_ferdous Asceticism (JOI18_asceticism) C++17
49 / 100
134 ms 150904 KB
#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

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 time Memory Grader output
1 Correct 56 ms 75560 KB Output is correct
2 Correct 56 ms 75512 KB Output is correct
3 Correct 55 ms 75512 KB Output is correct
4 Correct 56 ms 75484 KB Output is correct
5 Correct 58 ms 75512 KB Output is correct
6 Correct 57 ms 75512 KB Output is correct
7 Correct 57 ms 75512 KB Output is correct
8 Correct 55 ms 75512 KB Output is correct
9 Correct 56 ms 75512 KB Output is correct
10 Correct 55 ms 75512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 75560 KB Output is correct
2 Correct 56 ms 75512 KB Output is correct
3 Correct 55 ms 75512 KB Output is correct
4 Correct 56 ms 75484 KB Output is correct
5 Correct 58 ms 75512 KB Output is correct
6 Correct 57 ms 75512 KB Output is correct
7 Correct 57 ms 75512 KB Output is correct
8 Correct 55 ms 75512 KB Output is correct
9 Correct 56 ms 75512 KB Output is correct
10 Correct 55 ms 75512 KB Output is correct
11 Correct 56 ms 75500 KB Output is correct
12 Correct 57 ms 75612 KB Output is correct
13 Correct 56 ms 75512 KB Output is correct
14 Correct 56 ms 75512 KB Output is correct
15 Correct 59 ms 75640 KB Output is correct
16 Correct 56 ms 75512 KB Output is correct
17 Correct 56 ms 75512 KB Output is correct
18 Correct 56 ms 75512 KB Output is correct
19 Correct 56 ms 75512 KB Output is correct
20 Correct 56 ms 75556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 75560 KB Output is correct
2 Correct 56 ms 75512 KB Output is correct
3 Correct 55 ms 75512 KB Output is correct
4 Correct 56 ms 75484 KB Output is correct
5 Correct 58 ms 75512 KB Output is correct
6 Correct 57 ms 75512 KB Output is correct
7 Correct 57 ms 75512 KB Output is correct
8 Correct 55 ms 75512 KB Output is correct
9 Correct 56 ms 75512 KB Output is correct
10 Correct 55 ms 75512 KB Output is correct
11 Correct 56 ms 75500 KB Output is correct
12 Correct 57 ms 75612 KB Output is correct
13 Correct 56 ms 75512 KB Output is correct
14 Correct 56 ms 75512 KB Output is correct
15 Correct 59 ms 75640 KB Output is correct
16 Correct 56 ms 75512 KB Output is correct
17 Correct 56 ms 75512 KB Output is correct
18 Correct 56 ms 75512 KB Output is correct
19 Correct 56 ms 75512 KB Output is correct
20 Correct 56 ms 75556 KB Output is correct
21 Correct 62 ms 75620 KB Output is correct
22 Correct 56 ms 75644 KB Output is correct
23 Correct 65 ms 75588 KB Output is correct
24 Correct 62 ms 75640 KB Output is correct
25 Correct 56 ms 75640 KB Output is correct
26 Correct 77 ms 75660 KB Output is correct
27 Correct 59 ms 75512 KB Output is correct
28 Correct 57 ms 75512 KB Output is correct
29 Correct 57 ms 75580 KB Output is correct
30 Correct 57 ms 75736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 75560 KB Output is correct
2 Correct 56 ms 75512 KB Output is correct
3 Correct 55 ms 75512 KB Output is correct
4 Correct 56 ms 75484 KB Output is correct
5 Correct 58 ms 75512 KB Output is correct
6 Correct 57 ms 75512 KB Output is correct
7 Correct 57 ms 75512 KB Output is correct
8 Correct 55 ms 75512 KB Output is correct
9 Correct 56 ms 75512 KB Output is correct
10 Correct 55 ms 75512 KB Output is correct
11 Correct 56 ms 75500 KB Output is correct
12 Correct 57 ms 75612 KB Output is correct
13 Correct 56 ms 75512 KB Output is correct
14 Correct 56 ms 75512 KB Output is correct
15 Correct 59 ms 75640 KB Output is correct
16 Correct 56 ms 75512 KB Output is correct
17 Correct 56 ms 75512 KB Output is correct
18 Correct 56 ms 75512 KB Output is correct
19 Correct 56 ms 75512 KB Output is correct
20 Correct 56 ms 75556 KB Output is correct
21 Correct 62 ms 75620 KB Output is correct
22 Correct 56 ms 75644 KB Output is correct
23 Correct 65 ms 75588 KB Output is correct
24 Correct 62 ms 75640 KB Output is correct
25 Correct 56 ms 75640 KB Output is correct
26 Correct 77 ms 75660 KB Output is correct
27 Correct 59 ms 75512 KB Output is correct
28 Correct 57 ms 75512 KB Output is correct
29 Correct 57 ms 75580 KB Output is correct
30 Correct 57 ms 75736 KB Output is correct
31 Correct 56 ms 75576 KB Output is correct
32 Runtime error 134 ms 150904 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Halted 0 ms 0 KB -