Submission #391477

# Submission time Handle Problem Language Result Execution time Memory
391477 2021-04-18T20:53:43 Z aaravdodhia A Huge Tower (CEOI10_tower) C++17
100 / 100
307 ms 8168 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n,d;
    cin>>n>>d;
    int A[n];
    for(int i=0;i<n;++i) cin>>A[i];
    sort(A,A+n);
    int ans=1;
    for(int i=0,j=0;i<n;++i){
        while(j<i && A[i]-A[j]>d)
            j++;
        ans = (i-j+1)*1LL*ans%1000000009;
    }
    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 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 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 1 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 224 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 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 976 KB Output is correct
2 Correct 29 ms 952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 134 ms 3592 KB Output is correct
2 Correct 129 ms 3652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 296 ms 7036 KB Output is correct
2 Correct 307 ms 8168 KB Output is correct