Submission #469268

#TimeUsernameProblemLanguageResultExecution timeMemory
469268keta_tsimakuridzeAsceticism (JOI18_asceticism)C++14
49 / 100
47 ms24988 KiB
#include<bits/stdc++.h>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 3e3 + 5, mod = 1e9 + 7; // !
int t,n,dp[N][N],k;
main(){
	cin >> n >> k;
	dp[0][0] = 1;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j < k; j++) {
			dp[i][j] = dp[i - 1][j] * (j + 1);
			if(j) dp[i][j] = (dp[i][j] + dp[i - 1][j - 1] * (i - 1 - (j - 1))) % mod;
		}
	}
	cout << dp[n][k - 1];
 }

Compilation message (stderr)

asceticism.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...