Submission #930895

#TimeUsernameProblemLanguageResultExecution timeMemory
930895manizareAsceticism (JOI18_asceticism)C++14
49 / 100
32 ms25176 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #define pb push_back #define F first #define S second #define ld long double #define all(a) a.begin(),a.end() #define pii pair <int,int> #define int long long #define PII pair<pii , pii> #define sz(v) (int)v.size() #define rep(i , a , b) for(int i=a;i <= (b);i++) #define per(i , a , b) for(int i=a;i >= (b);i--) #define deb(x) cout <<#x << " : " << x << "\n" ; using namespace std ; const int maxn = 3002 , mod = 1e9 + 7 , b = 56 , maxp = 15e5 + 10, inf= 1e9+10 , lg = 20; int dp[maxn][maxn]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n , k ; cin >> n >> k ; dp[1][0] = 1; rep(i , 1 , n){ rep(j , 0, k){ dp[i+1][j] = (dp[i][j]*(j+1) + dp[i+1][j])%mod ; dp[i+1][j+1] = (dp[i][j] * (i-j) + dp[i+1][j+1])%mod ; } } cout << dp[n][k-1] << '\n'; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...