#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define endl '\n'
const ll inf=1e15;
const ll mod=1e6+7;
const ll maxn=10005;
ll arr[maxn];
ll nxt[maxn];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n,ele;
cin>>n;
for (int i=0;i<n;i++){
cin>>ele;
}
arr[1]=1;
for (int i=1;i<=n-1;i++){
for (int j=1;j<=i;j++){
nxt[j]+=arr[j]*j;
nxt[j+1]+=arr[j];
nxt[j]%=mod;
nxt[j+1]%=mod;
}
swap(arr,nxt);
memset(nxt,0,sizeof(nxt));
}
ll ans=0;
for (int i=1;i<=n;i++){
ans+=arr[i];
ans%=mod;
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
284 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
82 ms |
464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
254 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |