Submission #1139192

#TimeUsernameProblemLanguageResultExecution timeMemory
1139192tobilliskJob Scheduling (CEOI12_jobs)Java
Compilation error
0 ms0 KiB
import java.util.*; import java.io.*; public class Submit { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(f.readLine()); int N = Integer.parseInt(st.nextToken()); int D = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.nextToken()); job[] jobs = new job[M]; st = new StringTokenizer(f.readLine()); for (int m = 0; m < M; m++) jobs[m] = new job(m, Integer.parseInt(st.nextToken())); Arrays.sort (jobs, (a, b) -> a.t-b.t); int[] js = new int[N]; for (job j: jobs) js[j.t]++; int gapsize = D * 2 - 1; int sum = 0; int distance = 0; int comps = 0; for (int n = 0; n < N; n++) { if (distance < gapsize) distance++; else sum -= js[n-gapsize]; if (distance > D) comps = Math.max(comps, (sum + distance - 1) / distance); sum += js[n]; } out.println(comps); int start = 0; int i = 0; for (int n = 0; n < N; n++) { for (int j = 0; j < comps; j++) { if (start > n) break; if (i == M) break; out.print(jobs[i].i + 1 + " "); i++; js[start]--; if (js[start] == 0) start++; } out.println("0"); } out.close(); f.close(); } } class job {int i; int t; job (int i, int t) {this.i = i; this.t = t;}}

Compilation message (stderr)

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

=======