제출 #965028

#제출 시각아이디문제언어결과실행 시간메모리
965028QuantumPiJob Scheduling (CEOI12_jobs)Java
컴파일 에러
0 ms0 KiB
import java.io.*;
import java.util.*;
 
public class JobScheduling {
    public static int[] nums;
    public static int d;
    public static void main(String[] args) {
        Scanner fin = new Scanner(System.in);

        int n = fin.nextInt();
        d = fin.nextInt();
        int m = fin.nextInt();

        nums = new int[n-d];
        for (int i=0; i<m; i++) {
            nums[fin.nextInt()-1]++;
        }
        int low = 0;
        int high = 1000000000;
        while (low < high) {
            int mid = (low+high)/2;
            if (works(mid)) {
                high = mid;
            }
            else {
                low = mid+1;
            }
        }
        System.out.println(low);

        fin.close();
    }
    public static boolean works(int numMachines) {
        Queue<Integer> q = new PriorityQueue<>();
        int currentDay = 0;
        for (int i=0; i<nums[currentDay]; i++) {
            q.add(currentDay);
        }
        while (!q.isEmpty()) {
            for (int i=0; i<numMachines; i++) {
                if (!q.isEmpty()) {
                    if (q.poll()+d < currentDay) {
                        return false;
                    }
                }
            }
            currentDay++;
            if (currentDay < nums.length) {
                for (int i=0; i<nums[currentDay]; i++) {
                    q.add(currentDay);
                }
            }
        }
        return true;
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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