Submission #365121

#TimeUsernameProblemLanguageResultExecution timeMemory
365121dg2004A Huge Tower (CEOI10_tower)Java
Compilation error
0 ms0 KiB
import java.util.*; import java.io.*; public class Solution { static int MOD = 1000000009; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer token = new StringTokenizer(in.readLine()); int n = Integer.parseInt(token.nextToken()), d = Integer.parseInt(token.nextToken()); int[] ar = new int[n]; token = new StringTokenizer(in.readLine()); for (int a = 0; a < n; a++) ar[a] = Integer.parseInt(token.nextToken()); Arrays.sort(ar); int r = 0; int ans = 1; for (int l = 0; l < n; l++) { while (r < n - 1 && ar[r + 1] - ar[l] <= d) r++; int dist = r - l + 1; ans = (int)(((long)ans * dist) % MOD); } System.out.println(ans); } }

Compilation message (stderr)

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