답안 #100558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100558 2019-03-12T09:01:01 Z JPN20 Asceticism (JOI18_asceticism) C++17
49 / 100
302 ms 142256 KB
#include <bits/stdc++.h>
using namespace std;

long long dp[3009][3009], mod = 1000000007;

long long solve(long long N, long long K) {
	for (int i = 0; i <= N; i++) { for (int j = 0; j <= N; j++) dp[i][j] = 0; }
	
	dp[0][0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dp[i + 1][j] += 1LL * (1LL + j) * dp[i][j]; dp[i + 1][j] %= mod;
			dp[i + 1][j + 1] += 1LL * (i - j) * dp[i][j]; dp[i + 1][j + 1] %= mod;
		}
	}
	return dp[N][K - 1];
}

int main() {
	long long A, B; cin >> A >> B;
	cout << solve(A, B) << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 844 KB Output is correct
12 Correct 5 ms 2304 KB Output is correct
13 Correct 6 ms 2304 KB Output is correct
14 Correct 7 ms 2304 KB Output is correct
15 Correct 7 ms 2304 KB Output is correct
16 Correct 5 ms 2304 KB Output is correct
17 Correct 4 ms 1408 KB Output is correct
18 Correct 5 ms 1792 KB Output is correct
19 Correct 4 ms 1024 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 844 KB Output is correct
12 Correct 5 ms 2304 KB Output is correct
13 Correct 6 ms 2304 KB Output is correct
14 Correct 7 ms 2304 KB Output is correct
15 Correct 7 ms 2304 KB Output is correct
16 Correct 5 ms 2304 KB Output is correct
17 Correct 4 ms 1408 KB Output is correct
18 Correct 5 ms 1792 KB Output is correct
19 Correct 4 ms 1024 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 36 ms 12232 KB Output is correct
22 Correct 35 ms 12280 KB Output is correct
23 Correct 33 ms 12160 KB Output is correct
24 Correct 35 ms 12228 KB Output is correct
25 Correct 39 ms 12280 KB Output is correct
26 Correct 36 ms 12160 KB Output is correct
27 Correct 36 ms 12160 KB Output is correct
28 Correct 14 ms 5632 KB Output is correct
29 Correct 4 ms 1408 KB Output is correct
30 Correct 34 ms 12160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 3 ms 844 KB Output is correct
12 Correct 5 ms 2304 KB Output is correct
13 Correct 6 ms 2304 KB Output is correct
14 Correct 7 ms 2304 KB Output is correct
15 Correct 7 ms 2304 KB Output is correct
16 Correct 5 ms 2304 KB Output is correct
17 Correct 4 ms 1408 KB Output is correct
18 Correct 5 ms 1792 KB Output is correct
19 Correct 4 ms 1024 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 36 ms 12232 KB Output is correct
22 Correct 35 ms 12280 KB Output is correct
23 Correct 33 ms 12160 KB Output is correct
24 Correct 35 ms 12228 KB Output is correct
25 Correct 39 ms 12280 KB Output is correct
26 Correct 36 ms 12160 KB Output is correct
27 Correct 36 ms 12160 KB Output is correct
28 Correct 14 ms 5632 KB Output is correct
29 Correct 4 ms 1408 KB Output is correct
30 Correct 34 ms 12160 KB Output is correct
31 Runtime error 302 ms 142256 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Halted 0 ms 0 KB -