# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961572 | Unforgettablepl | Skyscraper (JOI16_skyscraper) | C++17 | 2063 ms | 448 KiB |
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;
#define int long long
const int modulo = 1e9+7;
bool check(int L,vector<int> &arr){
for(int i=1;i<arr.size();i++){
L-=abs(arr[i]-arr[i-1]);
}
return 0<=L;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,l;
cin >> n >> l;
vector<int> arr(n);
for(int&i:arr)cin>>i;
sort(arr.begin(),arr.end());
int ans = 0;
do {
if(check(l,arr))ans++;
} while(next_permutation(arr.begin(),arr.end()));
cout << ans%modulo << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |