답안 #379746

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
379746 2021-03-19T08:04:08 Z nafis_shifat Asceticism (JOI18_asceticism) C++14
49 / 100
158 ms 262148 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e5+5;
const int inf=1e9;
const ll mod = 1e9 + 7;
int main() {
	int n,k;

	cin >> n >> k;

	ll dp[n + 1][k + 1] = {};

	dp[1][0] = 1;

	for(int i = 2; i <= n; i++) {
		dp[i][0] = 1;
		for(int j = 1; j <= k; j++) {
			dp[i][j] = (dp[i - 1][j] * (j + 1)) % mod + (dp[i - 1][j - 1] * (i - j) % mod);
			dp[i][j] %= mod;
		}
	}

	cout<<dp[n][k - 1]<<endl;


	
}
# 결과 실행 시간 메모리 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 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 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 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 620 KB Output is correct
15 Correct 2 ms 1004 KB Output is correct
16 Correct 2 ms 1004 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 620 KB Output is correct
19 Correct 1 ms 492 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 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 620 KB Output is correct
15 Correct 2 ms 1004 KB Output is correct
16 Correct 2 ms 1004 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 620 KB Output is correct
19 Correct 1 ms 492 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 5 ms 3820 KB Output is correct
24 Correct 6 ms 4204 KB Output is correct
25 Correct 12 ms 7788 KB Output is correct
26 Correct 11 ms 8172 KB Output is correct
27 Correct 11 ms 8172 KB Output is correct
28 Correct 4 ms 2796 KB Output is correct
29 Correct 1 ms 492 KB Output is correct
30 Correct 11 ms 7788 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 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 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 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 620 KB Output is correct
15 Correct 2 ms 1004 KB Output is correct
16 Correct 2 ms 1004 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 620 KB Output is correct
19 Correct 1 ms 492 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 5 ms 3820 KB Output is correct
24 Correct 6 ms 4204 KB Output is correct
25 Correct 12 ms 7788 KB Output is correct
26 Correct 11 ms 8172 KB Output is correct
27 Correct 11 ms 8172 KB Output is correct
28 Correct 4 ms 2796 KB Output is correct
29 Correct 1 ms 492 KB Output is correct
30 Correct 11 ms 7788 KB Output is correct
31 Correct 4 ms 1900 KB Output is correct
32 Correct 7 ms 5120 KB Output is correct
33 Runtime error 158 ms 262148 KB Execution killed with signal 9
34 Halted 0 ms 0 KB -