Submission #1077634

# Submission time Handle Problem Language Result Execution time Memory
1077634 2024-08-27T08:27:49 Z MC123 Tents (JOI18_tents) C++14
0 / 100
2000 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
int bruh=1e9+7;
int dp(int n,int m){
    if(n<0||m<0)return 0;
    if(n==0||m==0)return 1;
    return (((dp(n-1,m)%bruh+(4*m*dp(n-1,m  -1))%bruh)%bruh+(dp(n-1,m-2)*m*(m-1)/2)%bruh)%bruh+(dp(n-2,m-1)*m*(n-1))%bruh)%bruh;
}
int main(){
    ios_base::sync_with_stdio (0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    cout<<dp(n,m)-1 ;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 348 KB Output is correct
5 Execution timed out 2088 ms 348 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 348 KB Output is correct
5 Execution timed out 2088 ms 348 KB Time limit exceeded
6 Halted 0 ms 0 KB -