Submission #1105515

#TimeUsernameProblemLanguageResultExecution timeMemory
1105515akzytrSkyscraper (JOI16_skyscraper)C++17
5 / 100
2066 ms512 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; /* n <= 8 Check all possible permutations */ int main() { int N, L; cin >> N >> L; int a[N]; for(int i = 0; i < N; i++) { cin >> a[i]; } sort(a, a + N); ll count = 0; do { ll dif = 0; for(int i = 1; i < N; i++) { dif += abs(a[i] - a[i - 1]); } if(dif <= L) { count++; } } while(next_permutation(a, a + N)); cout << count << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...