답안 #147316

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147316 2019-08-28T19:57:26 Z mosiashvililuka Tents (JOI18_tents) C++14
100 / 100
249 ms 71132 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,dp[3009][3009],mod=1000000007;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=0; c<=a+1; c++){
		for(d=0; d<=b+1; d++){
			dp[c][d]=1;
		}
	}
	for(c=1; c<=a; c++){
		for(d=1; d<=b; d++){
			dp[c][d]=c*dp[c-1][d-1]*4+dp[c][d-1];
			if(d>1) dp[c][d]+=c*(d-1)*dp[c-1][d-2];
			if(c>=2) dp[c][d]+=(c-1)*c/2*dp[c-2][d-1];
			dp[c][d]%=mod;
		}
	}
	cout<<(dp[a][b]-1+mod)%mod;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 3 ms 1144 KB Output is correct
5 Correct 3 ms 760 KB Output is correct
6 Correct 3 ms 1400 KB Output is correct
7 Correct 3 ms 888 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 2 ms 888 KB Output is correct
10 Correct 4 ms 1912 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 5 ms 2296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 3 ms 1144 KB Output is correct
5 Correct 3 ms 760 KB Output is correct
6 Correct 3 ms 1400 KB Output is correct
7 Correct 3 ms 888 KB Output is correct
8 Correct 3 ms 1528 KB Output is correct
9 Correct 2 ms 888 KB Output is correct
10 Correct 4 ms 1912 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 5 ms 2296 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 9 ms 9720 KB Output is correct
15 Correct 160 ms 55416 KB Output is correct
16 Correct 12 ms 4088 KB Output is correct
17 Correct 37 ms 12960 KB Output is correct
18 Correct 47 ms 17116 KB Output is correct
19 Correct 186 ms 63132 KB Output is correct
20 Correct 149 ms 51020 KB Output is correct
21 Correct 98 ms 33912 KB Output is correct
22 Correct 99 ms 35584 KB Output is correct
23 Correct 62 ms 27128 KB Output is correct
24 Correct 242 ms 71132 KB Output is correct
25 Correct 188 ms 61436 KB Output is correct
26 Correct 211 ms 66808 KB Output is correct
27 Correct 249 ms 69212 KB Output is correct