Submission #659114

# Submission time Handle Problem Language Result Execution time Memory
659114 2022-11-16T15:35:30 Z finn__ A Huge Tower (CEOI10_tower) C++17
100 / 100
112 ms 10540 KB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    size_t n;
    int64_t d;
    cin >> n >> d;

    vector<int64_t> blocks(n);
    for (int64_t &x : blocks)
        cin >> x;

    sort(blocks.begin(), blocks.end());
    auto it = blocks.begin(), jt = blocks.begin();
    int64_t possibilities = 1;

    while (jt != blocks.end())
    {
        while (it != jt && *jt - *it > d)
            it++;
        possibilities = (possibilities * (jt - it + 1)) % 1000000009;
        jt++;
    }

    cout << possibilities << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 596 KB Output is correct
2 Correct 10 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 2260 KB Output is correct
2 Correct 51 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 5076 KB Output is correct
2 Correct 112 ms 10540 KB Output is correct