Submission #1054982

# Submission time Handle Problem Language Result Execution time Memory
1054982 2024-08-12T13:40:41 Z Rojus Skyscraper (JOI16_skyscraper) C++14
5 / 100
2000 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    const long long mod=1000000007;
    int n, l;
    cin >> n >> l;
    vector<int> a;
    for(int i=0; i<n; i++)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    long long kiek=0;
    do
    {
        int sum=0;
        for(int i=0; i<n-1; i++)
        {
            sum+=abs(a[i]-a[i+1]);
        }
        if(sum<=l)
        {
            kiek++;
            kiek=kiek%mod;
        }

    }while(next_permutation(a.begin(), a.end()));
    cout << kiek;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 2039 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 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Execution timed out 2039 ms 348 KB Time limit exceeded
12 Halted 0 ms 0 KB -