# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132857 | tushar_2658 | Skyscraper (JOI16_skyscraper) | C++14 | 2078 ms | 376 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;
vector<int> v;
int main(int argc, char const *argv[])
{
// freopen("in.txt", "r", stdin);
int n, m;
scanf("%d %d", &n, &m);
for(int i=0; i<n; i++){
int x;
scanf("%d", &x);
v.push_back(x);
}
int ans = 0;
sort(v.begin(), v.end());
do{
int val = 0;
for(int i=1; i<(int)v.size(); i++){
val += abs(v[i] - v[i-1]);
}
if(val <= m)ans += 1;
}while(next_permutation(v.begin(), v.end()));
cout << ans <<endl;
return 0;
}
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... |