답안 #70013

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70013 2018-08-22T09:05:32 Z yogahmad Asceticism (JOI18_asceticism) C++14
49 / 100
145 ms 142136 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fbo find_by_order
#define ook order_of_key
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define MOD 1000000007
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 3003
#define pc(x) putchar_unlocked(x);
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;

long long dep[mx][mx],n,k;

long long dp(int n,int k){
	if(k>=n)return 0;
	if(k==0 || k==n-1)return 1;
	long long&ret=dep[n][k];
	if(ret!=-1)return ret;
	ret=0;
	ret=1LL*(n-k)*dp(n-1,k-1)%MOD+1LL*(k+1)*dp(n-1,k)%MOD;
	ret%=MOD;
	//cout<<n<<' '<<k<<' '<<ret<<endl;
	return ret;
}

int main(){
	reset(dep,-1);
	cin>>n>>k;
	cout<<dp(n,k-1)<<endl;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 70904 KB Output is correct
2 Correct 56 ms 71024 KB Output is correct
3 Correct 56 ms 71024 KB Output is correct
4 Correct 54 ms 71024 KB Output is correct
5 Correct 55 ms 71024 KB Output is correct
6 Correct 56 ms 71068 KB Output is correct
7 Correct 56 ms 71068 KB Output is correct
8 Correct 57 ms 71212 KB Output is correct
9 Correct 58 ms 71212 KB Output is correct
10 Correct 58 ms 71296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 70904 KB Output is correct
2 Correct 56 ms 71024 KB Output is correct
3 Correct 56 ms 71024 KB Output is correct
4 Correct 54 ms 71024 KB Output is correct
5 Correct 55 ms 71024 KB Output is correct
6 Correct 56 ms 71068 KB Output is correct
7 Correct 56 ms 71068 KB Output is correct
8 Correct 57 ms 71212 KB Output is correct
9 Correct 58 ms 71212 KB Output is correct
10 Correct 58 ms 71296 KB Output is correct
11 Correct 64 ms 71296 KB Output is correct
12 Correct 67 ms 71296 KB Output is correct
13 Correct 59 ms 71296 KB Output is correct
14 Correct 65 ms 71296 KB Output is correct
15 Correct 57 ms 71296 KB Output is correct
16 Correct 56 ms 71304 KB Output is correct
17 Correct 61 ms 71316 KB Output is correct
18 Correct 56 ms 71316 KB Output is correct
19 Correct 57 ms 71316 KB Output is correct
20 Correct 58 ms 71384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 70904 KB Output is correct
2 Correct 56 ms 71024 KB Output is correct
3 Correct 56 ms 71024 KB Output is correct
4 Correct 54 ms 71024 KB Output is correct
5 Correct 55 ms 71024 KB Output is correct
6 Correct 56 ms 71068 KB Output is correct
7 Correct 56 ms 71068 KB Output is correct
8 Correct 57 ms 71212 KB Output is correct
9 Correct 58 ms 71212 KB Output is correct
10 Correct 58 ms 71296 KB Output is correct
11 Correct 64 ms 71296 KB Output is correct
12 Correct 67 ms 71296 KB Output is correct
13 Correct 59 ms 71296 KB Output is correct
14 Correct 65 ms 71296 KB Output is correct
15 Correct 57 ms 71296 KB Output is correct
16 Correct 56 ms 71304 KB Output is correct
17 Correct 61 ms 71316 KB Output is correct
18 Correct 56 ms 71316 KB Output is correct
19 Correct 57 ms 71316 KB Output is correct
20 Correct 58 ms 71384 KB Output is correct
21 Correct 58 ms 71384 KB Output is correct
22 Correct 59 ms 71440 KB Output is correct
23 Correct 62 ms 71440 KB Output is correct
24 Correct 73 ms 71440 KB Output is correct
25 Correct 59 ms 71440 KB Output is correct
26 Correct 56 ms 71492 KB Output is correct
27 Correct 55 ms 71492 KB Output is correct
28 Correct 56 ms 71492 KB Output is correct
29 Correct 55 ms 71492 KB Output is correct
30 Correct 63 ms 71492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 70904 KB Output is correct
2 Correct 56 ms 71024 KB Output is correct
3 Correct 56 ms 71024 KB Output is correct
4 Correct 54 ms 71024 KB Output is correct
5 Correct 55 ms 71024 KB Output is correct
6 Correct 56 ms 71068 KB Output is correct
7 Correct 56 ms 71068 KB Output is correct
8 Correct 57 ms 71212 KB Output is correct
9 Correct 58 ms 71212 KB Output is correct
10 Correct 58 ms 71296 KB Output is correct
11 Correct 64 ms 71296 KB Output is correct
12 Correct 67 ms 71296 KB Output is correct
13 Correct 59 ms 71296 KB Output is correct
14 Correct 65 ms 71296 KB Output is correct
15 Correct 57 ms 71296 KB Output is correct
16 Correct 56 ms 71304 KB Output is correct
17 Correct 61 ms 71316 KB Output is correct
18 Correct 56 ms 71316 KB Output is correct
19 Correct 57 ms 71316 KB Output is correct
20 Correct 58 ms 71384 KB Output is correct
21 Correct 58 ms 71384 KB Output is correct
22 Correct 59 ms 71440 KB Output is correct
23 Correct 62 ms 71440 KB Output is correct
24 Correct 73 ms 71440 KB Output is correct
25 Correct 59 ms 71440 KB Output is correct
26 Correct 56 ms 71492 KB Output is correct
27 Correct 55 ms 71492 KB Output is correct
28 Correct 56 ms 71492 KB Output is correct
29 Correct 55 ms 71492 KB Output is correct
30 Correct 63 ms 71492 KB Output is correct
31 Correct 53 ms 71492 KB Output is correct
32 Runtime error 145 ms 142136 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Halted 0 ms 0 KB -