Submission #258089

# Submission time Handle Problem Language Result Execution time Memory
258089 2020-08-05T10:37:10 Z YJU Tents (JOI18_tents) C++14
0 / 100
1 ms 384 KB
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll N=3e3+5;
const ll M=1e4+5;
const ll MOD=1e9+7;
const ld pi=acos(-1);
const ll MOD2=998244353;
const ll INF=(1LL<<60);
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll n,m,dp[N][N];

ll C(ll k){
	if(k<2)return 0;
	return (k*(k-1)%MOD)*((MOD+1)/2)%MOD;
}

 
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	REP(i,n+1)dp[i][0]=1;REP(i,m+1)dp[0][i]=1;
	REP1(i,n){
		REP1(j,m){
			dp[i][j]+=dp[i-1][j];
			dp[i][j]+=dp[i-1][j-1]*j*4%MOD;
			dp[i][j]+=dp[i-1][j-2]*(C(j))%MOD;
			dp[i][j]+=dp[i-2][j-1]*(i-1)*j%MOD;
			dp[i][j]%=MOD;		
		}
	}
	cout<<(dp[n][m]+MOD-1)%MOD<<"\n";
	return 0;	
}

Compilation message

tents.cpp:11:18: warning: overflow in implicit constant conversion [-Woverflow]
 const ll INF=(1LL<<60);
              ~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -