# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68825 | IvanC | Asceticism (JOI18_asceticism) | C++17 | 139 ms | 142788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 3010;
const int MOD = 1e9 + 7;
ll dp[MAXN][MAXN];
int N,K;
ll solve(int dia,int grupos){
if(dp[dia][grupos] != -1) return dp[dia][grupos];
if(grupos == 0) return dp[dia][grupos] = 0;
if(dia == 1) return dp[dia][grupos] = (grupos == 1);
return dp[dia][grupos] = ((grupos)*solve(dia - 1,grupos) + (dia - grupos + 1)*solve(dia - 1,grupos - 1)) % MOD;
}
int main(){
memset(dp,-1,sizeof(dp));
cin >> N >> K;
cout << solve(N,K) << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |