#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>;
// int SLV[10011][10011];
int slv(int a,int b){
if(b==0)return 1;
// if(SLV[a][b]!=-1)return SLV[a][b];
return (slv(a+1,b-1)+slv(a,b-1)*a)%1000000007;
}
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
memset(SLV,-1,sizeof SLV);
int n;
cin>>n;
int arr[n];
for(auto &i:arr)cin>>i;
int ans=1;
int mx=0;
for(int i=0;i<n;i++){
for(int w=1;w<arr[i];w++)ans+=slv(max(mx,w),n-i-1);
mx=max(mx,arr[i]);
ans%=1000000007;
}
cout<<ans;
}
Compilation message
teams.cpp: In function 'int main()':
teams.cpp:17:12: error: 'SLV' was not declared in this scope
17 | memset(SLV,-1,sizeof SLV);
| ^~~