Submission #928190

#TimeUsernameProblemLanguageResultExecution timeMemory
928190crystalA Huge Tower (CEOI10_tower)Java
100 / 100
929 ms48684 KiB
import java.util.*; public class tower { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long mod =1000000009; int n = sc.nextInt(); int m = sc.nextInt(); int [] vals = new int [n]; for(int i =0;i<n;i++) { vals[i]=sc.nextInt(); } Arrays.sort(vals); int r=0; long ans =1; for(int i=0;i<n;i++) { while(r+1<n&&vals[r+1]-vals[i]<=m) { r++; } ans=ans*((long)r-i+1)%mod; ans%=mod; } System.out.println(ans); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...