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;
long long N, A[10005], memo[10005][10005], p = 1000007;
long long dp (long long n, long long m) {
if (n == N) return 1;
if (memo[n][m] != -1) return memo[n][m];
return memo[n][m] = (dp(n+1,m) * m + dp(n+1,m+1)) % p;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> N;
for (long long i = 0; i < N; ++i) cin >> A[i];
memset(memo,-1,sizeof(memo));
cout << dp(0,0);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |