제출 #1119582

#제출 시각아이디문제언어결과실행 시간메모리
1119582johuJob Scheduling (CEOI12_jobs)Java
컴파일 에러
0 ms0 KiB
import java.util.*;
import java.io.*;
public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(new DataInputStream(System.in)));
    static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    static StringTokenizer st;
    public static void main(String[] args) throws IOException {
        int N = nextInt(), D = nextInt(), M = nextInt(), cnt[] = new int[N + 1];
        for (int i = 0; i < M; i++)
            cnt[nextInt()]++;
        int l = 1, r = M, ans = 0;
        while (l <= r) {
            int m = (l + r) >> 1;
            boolean b = true;
            Deque<Integer> dq = new ArrayDeque<>();
            for (int i = 1; i <= N; i++) {
                if (!dq.isEmpty() && dq.peekFirst() < i) {
                    b = false;
                    break;
                }
                for (int j = 0; j < cnt[i]; j++)
                    dq.addLast(i + D);
                for (int j = 0; j < m; j++) {
                    if (dq.isEmpty()) break;
                    dq.pollFirst();
                }
            }
            if (b) {
                r = m - 1;
                ans = m;
            }
            else
                l = m + 1;
        }
        System.out.println(ans);
        for (int i = 0; i < N; i++)
            System.out.println(0);
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(st.nextToken());
    }
}

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

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