Submission #68616

# Submission time Handle Problem Language Result Execution time Memory
68616 2018-08-17T14:33:20 Z TadijaSebez Tents (JOI18_tents) C++11
0 / 100
2 ms 376 KB
#include <stdio.h>
#define ll long long
const int N=3005;
const int mod=1e9+7;
int dp[N][N];
int main()
{
	int n,m,i,j;
	scanf("%i %i",&n,&m);
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=m;j++)
		{
			if(i==0 || j==0){ dp[i][j]=1;continue;}
			dp[i][j]=dp[i-1][j]+(ll)dp[i-1][j-1]*j%mod*4%mod;
			dp[i][j]%=mod;
			if(i>1) dp[i][j]+=(ll)dp[i-2][j-1]*j%mod*(i-1)%mod;
			dp[i][j]%=mod;
			if(j>1) dp[i][j]+=(ll)dp[i-1][j-2]*j%mod*(j-1)%mod*((mod-1)/2)%mod;
			dp[i][j]%=mod;
		}
	}
	printf("%i\n",(dp[n][m]+mod-1)%mod);
	return 0;
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -