Submission #1091622

# Submission time Handle Problem Language Result Execution time Memory
1091622 2024-09-21T14:53:31 Z DottedHawk A Huge Tower (CEOI10_tower) C++17
100 / 100
205 ms 10644 KB
#include <iostream>
#include<algorithm>
#include <vector>
using namespace std;
typedef long long ll;
 
int main() {
    #ifdef LOCAL
    freopen("IO/input.txt", "r", stdin);
    #endif
 
    ll n,d; cin >> n >> d;
    vector<ll> V(n);
 
    for(auto& x: V) {
        cin >> x;
    }
 
    sort(V.begin(), V.end());
    ll ans = 1;
    //btwn 7 and 7-d inclusive
    auto lt = V.begin();
 
    for(auto rt = V.begin(); rt != V.end(); ++rt) {
        while((*rt - *lt)>d) {
            ++lt;
        } 
        ans *= ((rt-lt)+1);
        ans %= (1000000009);
    }
 
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 600 KB Output is correct
2 Correct 23 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 2392 KB Output is correct
2 Correct 87 ms 4668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 182 ms 5212 KB Output is correct
2 Correct 205 ms 10644 KB Output is correct