Submission #202266

#TimeUsernameProblemLanguageResultExecution timeMemory
202266SegtreeSkyscraper (JOI16_skyscraper)C++14
5 / 100
7 ms376 KiB
#include<iostream> #include<algorithm> #include<vector> #include<queue> #include<set> #include<unordered_set> #include<unordered_map> using namespace std; typedef long long ll; #define chmax(a,b) a=max(a,b) #define chmin(a,b) a=min(a,b) #define all(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<n;i++) #define mod 1000000007 #define mad(a,b) a=(a+b)%mod ll n,L,a[8]; int main(){ cin>>n>>L; if(n>8)return 0; rep(i,n)cin>>a[i]; sort(a,a+n); ll ans=0; do{ ll sum=0; rep(i,n-1){ sum+=abs(a[i]-a[i+1]); } ans+=sum<=L; }while(next_permutation(a,a+n)); cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...