Submission #388623

# Submission time Handle Problem Language Result Execution time Memory
388623 2021-04-12T09:34:56 Z denkendoemeer Tents (JOI18_tents) C++14
100 / 100
255 ms 31940 KB
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
#define ll long long
int dp[3005][3005];
ll calc(int a,int b)
{
    if (a<=0 || b<=0)
        return 1;
    if (dp[a][b])
        return dp[a][b];
    ll ans=0;
    ans+=calc(a-1,b);
    ans+=(b*(a-1))*calc(a-2,b-1);
    ans+=((b*(b-1))/2)*calc(a-1,b-2);
    ans+=calc(a-1,b-1)*b*4;
    ans=ans%mod;
    dp[a][b]=ans;
    return ans;
}
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    int n,m;
    scanf("%d%d",&n,&m);
    printf("%lld\n",calc(n,m)-1);
return 0;
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:26:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 1100 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 2 ms 1228 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 2 ms 1612 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 4 ms 1740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 1100 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 2 ms 1228 KB Output is correct
7 Correct 1 ms 588 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 2 ms 1612 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 4 ms 1740 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 6 ms 9676 KB Output is correct
15 Correct 158 ms 29084 KB Output is correct
16 Correct 3 ms 1356 KB Output is correct
17 Correct 17 ms 4960 KB Output is correct
18 Correct 37 ms 9208 KB Output is correct
19 Correct 187 ms 30904 KB Output is correct
20 Correct 141 ms 25400 KB Output is correct
21 Correct 83 ms 15932 KB Output is correct
22 Correct 100 ms 20132 KB Output is correct
23 Correct 71 ms 19400 KB Output is correct
24 Correct 255 ms 31940 KB Output is correct
25 Correct 179 ms 27076 KB Output is correct
26 Correct 224 ms 29732 KB Output is correct
27 Correct 239 ms 30912 KB Output is correct