Submission #1054846

#TimeUsernameProblemLanguageResultExecution timeMemory
1054846FaustasKSkyscraper (JOI16_skyscraper)C++14
5 / 100
2057 ms440 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...