Submission #310697

# Submission time Handle Problem Language Result Execution time Memory
310697 2020-10-07T16:17:48 Z arnold518 Tents (JOI18_tents) C++14
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 3000;
const ll MOD = 1e9+7;

int N, M;
ll dp[MAXN+10][MAXN+10];

int main()
{
	scanf("%d%d", &N, &M);
	for(int i=0; i<=N; i++)
	{
		for(int j=0; j<=M; j++)
		{
			if(i==0 || j==0)
			{
				dp[i][j]=1;
				continue;
			}
			if(j>=2) dp[i][j]+=(ll)j*(j-1)/2*dp[i-1][j-2]%MOD;
			dp[i][j]+=(ll)4*j*dp[i-1][j-1]%MOD;
			if(i>=2) dp[i][j]+=(ll)j*(i-1)*dp[i-2][j-1]%MOD;
			dp[i][j]+=dp[i-1][j];
			dp[i][j]%=MOD;
		}
	}
	printf("%lld\n", (dp[N][M]+1)%MOD);
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
# 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 -