Submission #393964

# Submission time Handle Problem Language Result Execution time Memory
393964 2021-04-25T04:57:31 Z jadDebugs A Huge Tower (CEOI10_tower) C++14
30 / 100
306 ms 5140 KB
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int mod = 1e9+9;

int main()
{
    int n, d; cin >> n >> d;

    vector<int> arr(n);
    vector<int> dp(n);
    dp[0] = 1;

    for (int i = 0; i < n; i++)
        cin >> arr[i];

    sort(arr.begin(), arr.end());

    int ans = 1; 
    for (int l = 0, r = 0; l < n; l++) {
        while (r < n - 1 && arr[r+1] - arr[l] <= d)
            r++;
        ans = ((r-l+1) * ans*1LL) % mod;
    }

    cout << ans;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 224 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 2252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 306 ms 5140 KB Output isn't correct
2 Halted 0 ms 0 KB -