답안 #330766

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
330766 2020-11-26T13:55:52 Z pit4h Asceticism (JOI18_asceticism) C++14
49 / 100
118 ms 94848 KB
#include<bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#ifndef LOCAL
#define cerr if(0)cerr
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using pii = pair<int, int>;
const ll mod = 1e9+7;
const int N = 3e3+1;
int n, K;
ll dp[N][N];
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>K;
	dp[0][0] = 1;
	for(int i=1; i<=n; ++i) {
		dp[i][0] = 1;
		for(int j=1; j<=i; ++j) {
			dp[i][j] = (dp[i-1][j-1] * (i-j) + dp[i-1][j] * (j+1))%mod; 
		}
	}
	cout<<dp[n][K-1]<<'\n';
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 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 376 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 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 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 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 376 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 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 384 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 1 ms 1900 KB Output is correct
13 Correct 1 ms 1900 KB Output is correct
14 Correct 1 ms 1900 KB Output is correct
15 Correct 1 ms 1900 KB Output is correct
16 Correct 2 ms 1900 KB Output is correct
17 Correct 1 ms 1260 KB Output is correct
18 Correct 1 ms 1644 KB Output is correct
19 Correct 1 ms 1004 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 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 376 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 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 384 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 1 ms 1900 KB Output is correct
13 Correct 1 ms 1900 KB Output is correct
14 Correct 1 ms 1900 KB Output is correct
15 Correct 1 ms 1900 KB Output is correct
16 Correct 2 ms 1900 KB Output is correct
17 Correct 1 ms 1260 KB Output is correct
18 Correct 1 ms 1644 KB Output is correct
19 Correct 1 ms 1004 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 6 ms 8300 KB Output is correct
22 Correct 6 ms 8300 KB Output is correct
23 Correct 6 ms 8448 KB Output is correct
24 Correct 6 ms 8300 KB Output is correct
25 Correct 6 ms 8300 KB Output is correct
26 Correct 6 ms 8300 KB Output is correct
27 Correct 6 ms 8300 KB Output is correct
28 Correct 3 ms 4204 KB Output is correct
29 Correct 1 ms 1260 KB Output is correct
30 Correct 6 ms 8300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 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 376 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 384 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 384 KB Output is correct
11 Correct 1 ms 748 KB Output is correct
12 Correct 1 ms 1900 KB Output is correct
13 Correct 1 ms 1900 KB Output is correct
14 Correct 1 ms 1900 KB Output is correct
15 Correct 1 ms 1900 KB Output is correct
16 Correct 2 ms 1900 KB Output is correct
17 Correct 1 ms 1260 KB Output is correct
18 Correct 1 ms 1644 KB Output is correct
19 Correct 1 ms 1004 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 6 ms 8300 KB Output is correct
22 Correct 6 ms 8300 KB Output is correct
23 Correct 6 ms 8448 KB Output is correct
24 Correct 6 ms 8300 KB Output is correct
25 Correct 6 ms 8300 KB Output is correct
26 Correct 6 ms 8300 KB Output is correct
27 Correct 6 ms 8300 KB Output is correct
28 Correct 3 ms 4204 KB Output is correct
29 Correct 1 ms 1260 KB Output is correct
30 Correct 6 ms 8300 KB Output is correct
31 Runtime error 118 ms 94848 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Halted 0 ms 0 KB -