# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851010 | 2023-09-18T08:02:00 Z | 8pete8 | Tents (JOI18_tents) | C++17 | 93 ms | 71760 KB |
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include<cstring> #include<limits.h> #include<cmath> #include<set> #include<algorithm> #include<bitset> //#include "supertrees.h" using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define ppii pair<int,pii> #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define F(n) for(int i=0;i<n;i++) #define lb lower_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); using namespace std; #define int long long const int mxn=3003,mod=1000000007,lg=20,root=80,inf=1e18; void setIO(string name) { ios_base::sync_with_stdio(0); cin.tie(0); freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } int dp[mxn+10][mxn+10],pl[mxn+10][mxn+10],pu[mxn+10][mxn+10]; int cnt[mxn+10]; int32_t main(){ fastio int n,m;cin>>n>>m; for(int i=0;i<=mxn;i++)dp[0][i]=dp[i][0]=1; for(int i=1;i<=mxn;i++){//main ;to not over count for(int j=1;j<=mxn;j++){ dp[i][j]+=dp[i-1][j]+(dp[i-1][j-1]*4*j)%mod; dp[i][j]%=mod; if(i>=2)dp[i][j]+=(dp[i-2][j-1]*(i-1)*j%mod)%mod; dp[i][j]%=mod; if(j>=2)dp[i][j]+=(dp[i-1][j-2]*(((j*(j-1))/2))%mod)%mod; dp[i][j]%=mod; } } cout<<dp[n][m]-1; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 71508 KB | Output is correct |
2 | Correct | 87 ms | 71508 KB | Output is correct |
3 | Correct | 91 ms | 71508 KB | Output is correct |
4 | Correct | 88 ms | 71504 KB | Output is correct |
5 | Correct | 87 ms | 71508 KB | Output is correct |
6 | Correct | 86 ms | 71504 KB | Output is correct |
7 | Correct | 93 ms | 71472 KB | Output is correct |
8 | Correct | 88 ms | 71728 KB | Output is correct |
9 | Correct | 87 ms | 71568 KB | Output is correct |
10 | Correct | 86 ms | 71508 KB | Output is correct |
11 | Correct | 86 ms | 71508 KB | Output is correct |
12 | Correct | 86 ms | 71508 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 71508 KB | Output is correct |
2 | Correct | 87 ms | 71508 KB | Output is correct |
3 | Correct | 91 ms | 71508 KB | Output is correct |
4 | Correct | 88 ms | 71504 KB | Output is correct |
5 | Correct | 87 ms | 71508 KB | Output is correct |
6 | Correct | 86 ms | 71504 KB | Output is correct |
7 | Correct | 93 ms | 71472 KB | Output is correct |
8 | Correct | 88 ms | 71728 KB | Output is correct |
9 | Correct | 87 ms | 71568 KB | Output is correct |
10 | Correct | 86 ms | 71508 KB | Output is correct |
11 | Correct | 86 ms | 71508 KB | Output is correct |
12 | Correct | 86 ms | 71508 KB | Output is correct |
13 | Correct | 86 ms | 71476 KB | Output is correct |
14 | Correct | 88 ms | 71476 KB | Output is correct |
15 | Correct | 86 ms | 71476 KB | Output is correct |
16 | Correct | 89 ms | 71476 KB | Output is correct |
17 | Correct | 87 ms | 71760 KB | Output is correct |
18 | Correct | 86 ms | 71476 KB | Output is correct |
19 | Correct | 86 ms | 71508 KB | Output is correct |
20 | Correct | 91 ms | 71476 KB | Output is correct |
21 | Correct | 86 ms | 71624 KB | Output is correct |
22 | Correct | 89 ms | 71508 KB | Output is correct |
23 | Correct | 90 ms | 71504 KB | Output is correct |
24 | Correct | 87 ms | 71492 KB | Output is correct |
25 | Correct | 89 ms | 71492 KB | Output is correct |
26 | Correct | 86 ms | 71584 KB | Output is correct |
27 | Correct | 87 ms | 71508 KB | Output is correct |