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<iostream>
#include<vector>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll power(ll a,ll b){
if(b==0) return 1;
if(b&1) return power(a,b-1)*a%mod;
ll tmp=power(a,b/2);
return tmp*tmp%mod;
}
ll inverse(ll a){
return power(a,mod-2);
}
int main(){
ll n,l;
cin>>n>>l;
vector<ll> vec(n);
vector<ll> fac(20001);
fac[0]=1;
for(ll i=1;i<=20000;i++) fac[i]=fac[i-1]*i%mod;
for(int i=0;i<n;i++) cin>>vec[i];
bool flag=1;
for(int i=0;i<n-1;i++){
if(vec[i]!=vec[i+1]){
flag=0;
break;
}
}
if(flag){
ll r=vec[0];
ll k=(l-1-(n-1)*r);
if(k<0){
cout<<0;
return 0;
}
cout<<fac[k+n]*inverse(fac[n])%mod*inverse(fac[k])%mod*fac[n]%mod;
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... |