답안 #68616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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);
  ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -