답안 #57139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
57139 2018-07-14T06:31:20 Z kriii Tents (JOI18_tents) C++17
100 / 100
142 ms 71716 KB
#include <stdio.h>

const long long mod = 1000000007;
long long d[3030][3030];

int main()
{
	int N,M; scanf ("%d %d",&N,&M);

	for (int i=0;i<=N;i++) for (int j=0;j<=M;j++){
		if (i == 0 || j == 0) d[i][j] = 1;
		else{
			d[i][j] = (d[i-1][j] + d[i-1][j-1] * j * 4) % mod;
			if (i >= 2) d[i][j] = (d[i][j] + d[i-2][j-1] * (i - 1) * j) % mod;
			if (j >= 2) d[i][j] = (d[i][j] + d[i-1][j-2] * j * (j - 1) / 2) % mod;
		}
	}

	printf ("%lld\n",(d[N][M]+mod-1)%mod);

	return 0;
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int N,M; scanf ("%d %d",&N,&M);
           ~~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 676 KB Output is correct
4 Correct 3 ms 1316 KB Output is correct
5 Correct 4 ms 1316 KB Output is correct
6 Correct 4 ms 1544 KB Output is correct
7 Correct 3 ms 1544 KB Output is correct
8 Correct 4 ms 1600 KB Output is correct
9 Correct 3 ms 1600 KB Output is correct
10 Correct 4 ms 2036 KB Output is correct
11 Correct 2 ms 2036 KB Output is correct
12 Correct 5 ms 2424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 3 ms 676 KB Output is correct
4 Correct 3 ms 1316 KB Output is correct
5 Correct 4 ms 1316 KB Output is correct
6 Correct 4 ms 1544 KB Output is correct
7 Correct 3 ms 1544 KB Output is correct
8 Correct 4 ms 1600 KB Output is correct
9 Correct 3 ms 1600 KB Output is correct
10 Correct 4 ms 2036 KB Output is correct
11 Correct 2 ms 2036 KB Output is correct
12 Correct 5 ms 2424 KB Output is correct
13 Correct 3 ms 2424 KB Output is correct
14 Correct 8 ms 9856 KB Output is correct
15 Correct 96 ms 55440 KB Output is correct
16 Correct 9 ms 55440 KB Output is correct
17 Correct 24 ms 55440 KB Output is correct
18 Correct 27 ms 55440 KB Output is correct
19 Correct 103 ms 63252 KB Output is correct
20 Correct 92 ms 63252 KB Output is correct
21 Correct 81 ms 63252 KB Output is correct
22 Correct 70 ms 63252 KB Output is correct
23 Correct 35 ms 63252 KB Output is correct
24 Correct 134 ms 71716 KB Output is correct
25 Correct 142 ms 71716 KB Output is correct
26 Correct 113 ms 71716 KB Output is correct
27 Correct 128 ms 71716 KB Output is correct