답안 #368195

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
368195 2021-02-19T18:36:54 Z rqi Asceticism (JOI18_asceticism) C++14
49 / 100
600 ms 71148 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MOD = 1e9+7;

const int mx = 3005;

struct mi{
	ll v;
	mi(){
		v = 0;
	}
	mi(ll _v){
		v = _v % MOD;
	}
};

mi& operator+=(mi& a, mi b){
	a.v+=b.v;
	if(a.v >= MOD) a.v-=MOD;
	return a;
}

mi operator+(mi a, mi b){
	a+=b;
	return a;
}

mi operator*(mi a, mi b){
	a.v = (a.v*b.v) % MOD;
	return a;
}

mi dp[mx][mx];

int main(){
	int N, K;
	cin >> N >> K;

	dp[0][0] = mi(1);

	for(int i = 0; i <= N+2; i++){
		for(int j = 0; j <= N+2; j++){
			dp[i][j+1]+=mi(i+1)*dp[i][j];
			dp[i+1][j]+=mi(j+1)*dp[i][j];
		}
	}

	cout << dp[N-K][K-1].v << "\n";

}
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 71020 KB Output is correct
2 Correct 41 ms 71020 KB Output is correct
3 Correct 49 ms 71020 KB Output is correct
4 Correct 41 ms 71020 KB Output is correct
5 Correct 41 ms 71020 KB Output is correct
6 Correct 42 ms 71020 KB Output is correct
7 Correct 42 ms 71020 KB Output is correct
8 Correct 42 ms 71020 KB Output is correct
9 Correct 42 ms 71020 KB Output is correct
10 Correct 42 ms 71020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 71020 KB Output is correct
2 Correct 41 ms 71020 KB Output is correct
3 Correct 49 ms 71020 KB Output is correct
4 Correct 41 ms 71020 KB Output is correct
5 Correct 41 ms 71020 KB Output is correct
6 Correct 42 ms 71020 KB Output is correct
7 Correct 42 ms 71020 KB Output is correct
8 Correct 42 ms 71020 KB Output is correct
9 Correct 42 ms 71020 KB Output is correct
10 Correct 42 ms 71020 KB Output is correct
11 Correct 42 ms 71020 KB Output is correct
12 Correct 43 ms 71020 KB Output is correct
13 Correct 43 ms 71020 KB Output is correct
14 Correct 43 ms 71020 KB Output is correct
15 Correct 44 ms 71020 KB Output is correct
16 Correct 43 ms 71020 KB Output is correct
17 Correct 43 ms 71020 KB Output is correct
18 Correct 43 ms 71020 KB Output is correct
19 Correct 58 ms 71020 KB Output is correct
20 Correct 41 ms 71020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 71020 KB Output is correct
2 Correct 41 ms 71020 KB Output is correct
3 Correct 49 ms 71020 KB Output is correct
4 Correct 41 ms 71020 KB Output is correct
5 Correct 41 ms 71020 KB Output is correct
6 Correct 42 ms 71020 KB Output is correct
7 Correct 42 ms 71020 KB Output is correct
8 Correct 42 ms 71020 KB Output is correct
9 Correct 42 ms 71020 KB Output is correct
10 Correct 42 ms 71020 KB Output is correct
11 Correct 42 ms 71020 KB Output is correct
12 Correct 43 ms 71020 KB Output is correct
13 Correct 43 ms 71020 KB Output is correct
14 Correct 43 ms 71020 KB Output is correct
15 Correct 44 ms 71020 KB Output is correct
16 Correct 43 ms 71020 KB Output is correct
17 Correct 43 ms 71020 KB Output is correct
18 Correct 43 ms 71020 KB Output is correct
19 Correct 58 ms 71020 KB Output is correct
20 Correct 41 ms 71020 KB Output is correct
21 Correct 56 ms 71020 KB Output is correct
22 Correct 53 ms 71020 KB Output is correct
23 Correct 57 ms 71044 KB Output is correct
24 Correct 54 ms 71020 KB Output is correct
25 Correct 51 ms 71020 KB Output is correct
26 Correct 78 ms 71148 KB Output is correct
27 Correct 57 ms 71060 KB Output is correct
28 Correct 48 ms 71020 KB Output is correct
29 Correct 45 ms 71020 KB Output is correct
30 Correct 51 ms 71020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 71020 KB Output is correct
2 Correct 41 ms 71020 KB Output is correct
3 Correct 49 ms 71020 KB Output is correct
4 Correct 41 ms 71020 KB Output is correct
5 Correct 41 ms 71020 KB Output is correct
6 Correct 42 ms 71020 KB Output is correct
7 Correct 42 ms 71020 KB Output is correct
8 Correct 42 ms 71020 KB Output is correct
9 Correct 42 ms 71020 KB Output is correct
10 Correct 42 ms 71020 KB Output is correct
11 Correct 42 ms 71020 KB Output is correct
12 Correct 43 ms 71020 KB Output is correct
13 Correct 43 ms 71020 KB Output is correct
14 Correct 43 ms 71020 KB Output is correct
15 Correct 44 ms 71020 KB Output is correct
16 Correct 43 ms 71020 KB Output is correct
17 Correct 43 ms 71020 KB Output is correct
18 Correct 43 ms 71020 KB Output is correct
19 Correct 58 ms 71020 KB Output is correct
20 Correct 41 ms 71020 KB Output is correct
21 Correct 56 ms 71020 KB Output is correct
22 Correct 53 ms 71020 KB Output is correct
23 Correct 57 ms 71044 KB Output is correct
24 Correct 54 ms 71020 KB Output is correct
25 Correct 51 ms 71020 KB Output is correct
26 Correct 78 ms 71148 KB Output is correct
27 Correct 57 ms 71060 KB Output is correct
28 Correct 48 ms 71020 KB Output is correct
29 Correct 45 ms 71020 KB Output is correct
30 Correct 51 ms 71020 KB Output is correct
31 Execution timed out 1091 ms 71020 KB Time limit exceeded
32 Halted 0 ms 0 KB -