Submission #1079236

#TimeUsernameProblemLanguageResultExecution timeMemory
1079236vnm06Skyscraper (JOI16_skyscraper)C++14
5 / 100
2043 ms380 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; int n, l; int a[12]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>l; for(int i=0; i<n; i++) cin>>a[i]; sort(a, a+n); int br=0; do { int sum=0; for(int i=1; i<n; i++) { sum+=max(a[i]-a[i-1], a[i-1]-a[i]); } if(sum<=l) br++; }while(next_permutation(a, a+n)); cout<<br<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...