답안 #320391

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320391 2020-11-08T14:00:57 Z NachoLibre Asceticism (JOI18_asceticism) C++14
49 / 100
50 ms 25080 KB
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9 + 7;
const int N = 3003, K = N;
int n, k, dp[N][K];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> k;
	dp[0][0] = 1;
	for(int i = 1; i <= n; ++i) {
		dp[i][0] = dp[i - 1][0];
		for(int j = 1; j <= min(k, i - 1); ++j) {
			dp[i][j] = (1ll * dp[i - 1][j - 1] * (i - j) + 1ll * dp[i - 1][j] * (j + 1)) % mod;
		}
	}
	cout << dp[n][k - 1] << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 368 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 368 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 1 ms 1516 KB Output is correct
14 Correct 2 ms 1688 KB Output is correct
15 Correct 1 ms 1772 KB Output is correct
16 Correct 1 ms 1772 KB Output is correct
17 Correct 1 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 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 368 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 1 ms 1516 KB Output is correct
14 Correct 2 ms 1688 KB Output is correct
15 Correct 1 ms 1772 KB Output is correct
16 Correct 1 ms 1772 KB Output is correct
17 Correct 1 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 1 ms 364 KB Output is correct
21 Correct 3 ms 4332 KB Output is correct
22 Correct 2 ms 4332 KB Output is correct
23 Correct 4 ms 5740 KB Output is correct
24 Correct 4 ms 5868 KB Output is correct
25 Correct 5 ms 6252 KB Output is correct
26 Correct 6 ms 6380 KB Output is correct
27 Correct 4 ms 6252 KB Output is correct
28 Correct 2 ms 3436 KB Output is correct
29 Correct 1 ms 1132 KB Output is correct
30 Correct 4 ms 6252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 368 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 1 ms 1516 KB Output is correct
13 Correct 1 ms 1516 KB Output is correct
14 Correct 2 ms 1688 KB Output is correct
15 Correct 1 ms 1772 KB Output is correct
16 Correct 1 ms 1772 KB Output is correct
17 Correct 1 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 1 ms 364 KB Output is correct
21 Correct 3 ms 4332 KB Output is correct
22 Correct 2 ms 4332 KB Output is correct
23 Correct 4 ms 5740 KB Output is correct
24 Correct 4 ms 5868 KB Output is correct
25 Correct 5 ms 6252 KB Output is correct
26 Correct 6 ms 6380 KB Output is correct
27 Correct 4 ms 6252 KB Output is correct
28 Correct 2 ms 3436 KB Output is correct
29 Correct 1 ms 1132 KB Output is correct
30 Correct 4 ms 6252 KB Output is correct
31 Runtime error 50 ms 25080 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Halted 0 ms 0 KB -