이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int MOD=1e9+7;
int dp[3005][3005];
int main()
{
#ifdef HOME
freopen("test.in","r",stdin);
freopen("test.out","w",stdout);
#endif // HOME
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,k,i,j;
cin>>n>>k;
dp[0][0]=1;
for(i=0; i<=n; i++)
for(j=0; j<=k; j++)
{
dp[i+1][j]=(dp[i+1][j]+1LL*j*dp[i][j])%MOD;
dp[i+1][j+1]=(dp[i+1][j+1]+1LL*(i+1-j)*dp[i][j])%MOD;
}
cout<<dp[n][k];
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... |