# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
857442 | 2023-10-06T08:01:44 Z | CMJ | A Huge Tower (CEOI10_tower) | C | 0 ms | 0 KB |
#include <algorithm> #include <stdio.h> int b[1000000];int main(){int n,d; scanf("%d %d\n",&n,&d);long long sol=1;for(int i=0;i<n;i++)scanf("%d",b+i);std::sort(b,b+n);for(int l=0,r=0;l<n;l++){while((r<n)&&(b[r]<=b[l]+d))r++;sol*=(r-l);sol%=1000000009;}printf("%d\n",sol);}