Submission #364206

# Submission time Handle Problem Language Result Execution time Memory
364206 2021-02-08T11:54:33 Z fhvirus Asceticism (JOI18_asceticism) C++17
49 / 100
8 ms 8300 KB
#include<cstdio>
#include<cassert>
#define ll long long

const int N = 3003, M = 1'000'000'007;
ll dp[N][N];

int main(){
	int n, k; scanf("%d%d", &n, &k);
	assert(n <= 3000);
	dp[0][0] = 1;
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= i and j <= k; ++j){
			dp[i][j] += dp[i-1][j] * j;
			dp[i][j] += dp[i-1][j-1] * (i - (j - 1));
			dp[i][j] %= M;
		}
	}
//	for(int i = 0; i <= n; ++i){
//	    for(int j = 0; j < k; ++j){
//	        printf("%lld ", dp[i][j]);
//	    }
//	    puts("");
//	}
	printf("%lld", dp[n][k]);
	return 0;
}

Compilation message

asceticism.cpp: In function 'int main()':
asceticism.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |  int n, k; scanf("%d%d", &n, &k);
      |            ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1516 KB Output is correct
14 Correct 2 ms 1900 KB Output is correct
15 Correct 2 ms 1900 KB Output is correct
16 Correct 2 ms 2048 KB Output is correct
17 Correct 2 ms 1132 KB Output is correct
18 Correct 1 ms 1516 KB Output is correct
19 Correct 1 ms 876 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1516 KB Output is correct
14 Correct 2 ms 1900 KB Output is correct
15 Correct 2 ms 1900 KB Output is correct
16 Correct 2 ms 2048 KB Output is correct
17 Correct 2 ms 1132 KB Output is correct
18 Correct 1 ms 1516 KB Output is correct
19 Correct 1 ms 876 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 3 ms 4332 KB Output is correct
22 Correct 3 ms 4332 KB Output is correct
23 Correct 7 ms 7148 KB Output is correct
24 Correct 7 ms 7276 KB Output is correct
25 Correct 8 ms 8300 KB Output is correct
26 Correct 8 ms 8300 KB Output is correct
27 Correct 8 ms 8300 KB Output is correct
28 Correct 4 ms 4204 KB Output is correct
29 Correct 1 ms 1260 KB Output is correct
30 Correct 7 ms 8172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 2 ms 1516 KB Output is correct
13 Correct 2 ms 1516 KB Output is correct
14 Correct 2 ms 1900 KB Output is correct
15 Correct 2 ms 1900 KB Output is correct
16 Correct 2 ms 2048 KB Output is correct
17 Correct 2 ms 1132 KB Output is correct
18 Correct 1 ms 1516 KB Output is correct
19 Correct 1 ms 876 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 3 ms 4332 KB Output is correct
22 Correct 3 ms 4332 KB Output is correct
23 Correct 7 ms 7148 KB Output is correct
24 Correct 7 ms 7276 KB Output is correct
25 Correct 8 ms 8300 KB Output is correct
26 Correct 8 ms 8300 KB Output is correct
27 Correct 8 ms 8300 KB Output is correct
28 Correct 4 ms 4204 KB Output is correct
29 Correct 1 ms 1260 KB Output is correct
30 Correct 7 ms 8172 KB Output is correct
31 Runtime error 4 ms 364 KB Execution killed with signal 6
32 Halted 0 ms 0 KB -