# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034073 | 2024-07-25T09:29:20 Z | vjudge1 | Tents (JOI18_tents) | C++14 | 58 ms | 82984 KB |
#include <bits/stdc++.h> #define fi first #define se second #define ll long long #define ull unsigned long long #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define taskname "" using namespace std; const int mod=1e9+7; ll n,m,i,j,dp[5009][5009]; int main() { if (fopen(taskname".inp","r")) { freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>m; dp[0][0]=1; for(i=1;i<=m;i++) dp[0][i]=1; for(i=1;i<=n;i++) for(j=0;j<=m;j++){ //TH1: dp[i][j]=dp[i-1][j]; //TH2: if(j>=2) dp[i][j]+=dp[i-1][j-2]*j*(j-1)/2; //TH3: dp[i][j]+=dp[i-1][j-1]*j*4; if(i>=2) dp[i][j]+=dp[i-2][j-1]*j*(i-1); dp[i][j]%=mod; }cout<<(dp[n][m]+mod-1)%mod; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 0 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 1372 KB | Output is correct |
7 | Correct | 1 ms | 860 KB | Output is correct |
8 | Correct | 1 ms | 1372 KB | Output is correct |
9 | Correct | 1 ms | 860 KB | Output is correct |
10 | Correct | 1 ms | 1884 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 2140 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 1116 KB | Output is correct |
5 | Correct | 0 ms | 604 KB | Output is correct |
6 | Correct | 1 ms | 1372 KB | Output is correct |
7 | Correct | 1 ms | 860 KB | Output is correct |
8 | Correct | 1 ms | 1372 KB | Output is correct |
9 | Correct | 1 ms | 860 KB | Output is correct |
10 | Correct | 1 ms | 1884 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 2140 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 3 ms | 9820 KB | Output is correct |
15 | Correct | 38 ms | 55376 KB | Output is correct |
16 | Correct | 3 ms | 4188 KB | Output is correct |
17 | Correct | 8 ms | 12892 KB | Output is correct |
18 | Correct | 11 ms | 17244 KB | Output is correct |
19 | Correct | 44 ms | 63076 KB | Output is correct |
20 | Correct | 34 ms | 51028 KB | Output is correct |
21 | Correct | 23 ms | 33876 KB | Output is correct |
22 | Correct | 23 ms | 35676 KB | Output is correct |
23 | Correct | 20 ms | 27224 KB | Output is correct |
24 | Correct | 58 ms | 82984 KB | Output is correct |
25 | Correct | 44 ms | 63044 KB | Output is correct |
26 | Correct | 50 ms | 71508 KB | Output is correct |
27 | Correct | 55 ms | 79700 KB | Output is correct |