Submission #973536

# Submission time Handle Problem Language Result Execution time Memory
973536 2024-05-02T06:50:17 Z Aiperiii Skyscraper (JOI16_skyscraper) C++14
5 / 100
2000 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n,l;
    cin>>n>>l;
    vector <int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(all(a));
    int res=0;
    do{
        int sum=0;
        for(auto i=0;i<n-1;i++){
            sum+=abs(a[i]-a[i+1]);
        }
        if(sum<=l)res++;
    }while(next_permutation(all(a)));
    cout<<res<<"\n";
    
}
/*
 4 10
 3 6 2 9
 
 8 35
 3 7 1 5 10 2 11 6
*/


# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2043 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Execution timed out 2043 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -