Submission #1116438

#TimeUsernameProblemLanguageResultExecution timeMemory
1116438YugiHackerTents (JOI18_tents)C++17
100 / 100
103 ms102356 KiB
/* www.youtube.com/YugiHackerChannel linktr.ee/YugiHacker */ #include<bits/stdc++.h> #define el cout<<"\n" #define f0(i,n) for(int i=0;i<n;++i) #define f1(i,n) for(int i=1;i<=n;++i) #define maxn 5003 #define MOD 1000000007 using namespace std; long long f[5003][5003]; int n, m; main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // freopen("flagger.inp", "r", stdin); // freopen("flagger.out", "w", stdout); cin >> n >> m; f0 (i, max(n, m) + 1) f[0][i] = f[i][0] = 1; f1 (i, n) f1 (j, m) { f[i][j] = f[i-1][j]; (f[i][j] += 4 * f[i-1][j-1] * j) %= MOD; if (i >= 2) (f[i][j] += f[i-2][j-1] * (i-1) * j) %= MOD; if (j >= 2) (f[i][j] += f[i-1][j-2] * j * (j-1) / 2) %= MOD; } cout << (f[n][m] - 1 + MOD) % MOD; }

Compilation message (stderr)

tents.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...