# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
857442 | CMJ | A Huge Tower (CEOI10_tower) | C11 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);}