Submission #367298

#TimeUsernameProblemLanguageResultExecution timeMemory
367298VectorizedA Huge Tower (CEOI10_tower)Java
Compilation error
0 ms0 KiB
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class HugeTower { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); long MOD = 1000000009; int n = Integer.parseInt(st.nextToken()), m = Integer.parseInt(st.nextToken()); int[] ar = new int[n]; st = new StringTokenizer(br.readLine()); for (int i = 0; i < n; i++) { ar[i] = Integer.parseInt(st.nextToken()); } long ans = 1; Arrays.sort(ar); int pointer = 0; for (int i = 0; i < n; i++) { for(;pointer<n && ar[pointer] - ar[i] <= m;pointer++){} // System.out.println(i + " " + pointer); ans = ans * ((long)(pointer - i)) % MOD; } System.out.println(ans); } }

Compilation message (stderr)

tower.java:7: error: class HugeTower is public, should be declared in a file named HugeTower.java
public class HugeTower {
       ^
1 error