# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134029 | tutis | Tents (JOI18_tents) | C++17 | 175 ms | 31324 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*input
4 3
*/
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll modulo = 1000000007;
ll M[3030][3030];
ll f(ll w, ll h)
{
if (w > h)
swap(w, h);
if (M[w][h] != 0)
return M[w][h];
if (w == 0)
return 1;
if (w == 1)
return h * (h - 1) / 2 + 4 * h + 1;
ll ret = f(w, h - 1);
ret += f(w - 2, h - 1) * ((w) * (w - 1) / 2);
ret %= modulo;
ret += f(w - 1, h - 1) * w * 4;
ret %= modulo;
ret += f(w - 1, h - 2) * w * (h - 1);
ret %= modulo;
return M[w][h] = ret;
}
int main()
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |