#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define fi first
#define se second
#define pb push_back
signed main() {
//the boost
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
//main code
ll n,l,MOD=1000000007;
cin>> n >> l;
vector<ll>arr(n);
for (ll i = 0; i < n; ++i) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
ll ans = 0;
do {
ll sum=0;
for (ll i = 1; i < n; ++i) {
sum+=abs(arr[i]-arr[i-1]);
}
if (sum<=l){
ans++;
ans%=MOD;
}
}while (next_permutation(arr.begin(), arr.end()));
cout << ans << endl;
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... |