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 <bits/stdc++.h>
using namespace std;
int main()
{
vector <int> V;
int n, k;
cin >> n >> k;
for(int i = 0; i<n ;i++)
{
int x;
cin >> x;
V.push_back(x);
}
int ats = 0;
int c = 0;
sort(V.begin(), V.end());
do
{
c++;
long long skirt = 0;
for(int i = 1; i<n; i++)
{
skirt += abs(V[i] - V[i-1]);
}
if(skirt <= k) ats++;
} while(next_permutation(V.begin(), V.end()));
cout << ats;
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... |