#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 |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
424 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
468 KB |
Output is correct |
9 |
Correct |
1 ms |
428 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
424 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
468 KB |
Output is correct |
9 |
Correct |
1 ms |
428 KB |
Output is correct |
10 |
Correct |
1 ms |
468 KB |
Output is correct |
11 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |