답안 #997219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
997219 2024-06-11T20:53:39 Z goduadzesaba Tents (JOI18_tents) C++17
100 / 100
40 ms 71024 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=3e3+5,mod=1e9+7;
int n,m,dp[N][N];
signed main() {
	ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>m;
    for (int i=0; i<=n; i++) dp[i][0]=1;
    for (int j=0; j<=m; j++) dp[0][j]=1;
    for (int i=1; i<=n; i++)
    	for (int j=1; j<=m; j++){
    		dp[i][j]=dp[i-1][j];
    		if (j>1) dp[i][j]+=dp[i-1][j-2]*j*(j-1)/2;
			dp[i][j]+=dp[i-1][j-1]*4*j;
			if (i>1) dp[i][j]+=dp[i-2][j-1]*j*(i-1);
			dp[i][j]%=mod;
		}
	cout<<dp[n][m]-1;
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:12:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   12 |     for (int i=1; i<=n; i++)
      |     ^~~
tents.cpp:20:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   20 |  cout<<dp[n][m]-1;
      |  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 1 ms 2504 KB Output is correct
6 Correct 1 ms 6488 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 1 ms 2504 KB Output is correct
6 Correct 1 ms 6488 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 5 ms 55640 KB Output is correct
15 Correct 28 ms 66280 KB Output is correct
16 Correct 3 ms 6744 KB Output is correct
17 Correct 7 ms 16888 KB Output is correct
18 Correct 9 ms 29276 KB Output is correct
19 Correct 30 ms 70216 KB Output is correct
20 Correct 25 ms 57948 KB Output is correct
21 Correct 18 ms 39516 KB Output is correct
22 Correct 18 ms 51804 KB Output is correct
23 Correct 13 ms 70488 KB Output is correct
24 Correct 40 ms 71024 KB Output is correct
25 Correct 32 ms 62040 KB Output is correct
26 Correct 35 ms 68360 KB Output is correct
27 Correct 40 ms 70232 KB Output is correct