This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
ll N, K;
int main() {
scanf("%lld%lld", &N, &K);
vector<ll> cache(N + 1);
cache[0] = cache[1] = 1;
for (ll i = 2; i <= N; i++)
cache[i] = ((cache[i - 1] * 2 + cache[i - 2] * 4 * (i - 1)) % MOD / (i + 1) % MOD) % MOD;
printf("%lld", cache[N]);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |