Submission #72456

# Submission time Handle Problem Language Result Execution time Memory
72456 2018-08-26T08:19:11 Z Vahan Tents (JOI18_tents) C++17
0 / 100
2 ms 248 KB
#include<iostream>
using namespace std;
long long d[3002][3002], n, m;
long long mod = 1000000007;
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	{
		d[i][0] = 1;
		d[i][1] = i*(i - 1) / 2 + 4 * i + 1;
	}
	for (int i = 1; i <= m; i++)
	{
		d[0][i] = 1;
		d[1][i] = i*(i - 1) / 2 + 4 * i + 1;
	}
	cout << 11 << endl;
	for (long long i = 2; i <= n; i++)
	{
		for (long long j = 2; j <= m; j++)
		{
			d[i][j] = ((i*(i - 1) / 2) * d[i - 2][j - 1] + i * 4 * d[i - 1][j - 1] + i*(j - 1)*d[i - 1][j - 2] + d[i][j - 1]) % mod;
		}
	}
	cout << (d[n][m] - 1 + mod) % mod << endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -