Submission #1077637

# Submission time Handle Problem Language Result Execution time Memory
1077637 2024-08-27T08:28:16 Z boyan2010 Tents (JOI18_tents) C++17
48 / 100
2 ms 2396 KB
#include<bits/stdc++.h>
using namespace std;
long long n,m,dp[301][301];
bool vis[301][301];
const long long mod=1e9+7;
long long f(long long i,long long j)
{
    if(j==0 || i==0)
    {
        return 1;
    }
    if(i<0 || j<0)
    {
        return 0;
    }
    if(vis[i][j])
    {
        return dp[i][j];
    }
    vis[i][j]=1;
    dp[i][j]=((((f(i-1,j)+4*j*f(i-1,j-1))%mod+f(i-1,j-2)*j*(j-1)/2)%mod)+f(i-2,j-1)*j*(i-1))%mod;
    return dp[i][j];
}
int main()
{
    cin>>n>>m;
    cout<<f(n,m)-1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 944 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 1208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 944 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 1208 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Runtime error 2 ms 2396 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -