Submission #1154404

#TimeUsernameProblemLanguageResultExecution timeMemory
1154404finemJob Scheduling (CEOI12_jobs)Java
Compilation error
0 ms0 KiB
import java.util.*;
public class JobScheduling{
    public static void main(String[] args){
    int days = in.nextInt();
    int delay = in.nextInt();
    int numRequests = in.nextInt();
    int[] log = new int[numRequests];
    Map<Integer, Integer> freq = new TreeMap<>();
        
    for(int i = 0; i < numRequests; i++){
        log[i] = in.nextInt(); 
        freq.put(log[i], freq.getOrDefault(log[i],0)+1);
    }
    Arrays.sort(log);
    long higher = Integer.MAX_VALUE;
    long lower = 1;
    boolean condition = true;
    while(higher > lower){
        long mid = (higher+lower)/2;
        if(mid >= numRequests){condition = true;}
        int delaydays = 0;
        for(int i = 1; i <= days-delay; i++){
            int temp = freq.get(i) - delay;
            if(temp > 0){
                delaydays += temp;
            }
            if(delaydays > delay){
                condition = false;
                break;
            }
        }
        
        if(!condition){
           lower = mid+1; 
        }
        else{
            higher = mid;
        }
    }
}
}

Compilation message (stderr)

jobs.java:2: error: class JobScheduling is public, should be declared in a file named JobScheduling.java
public class JobScheduling{
       ^
jobs.java:4: error: cannot find symbol
    int days = in.nextInt();
               ^
  symbol:   variable in
  location: class JobScheduling
jobs.java:5: error: cannot find symbol
    int delay = in.nextInt();
                ^
  symbol:   variable in
  location: class JobScheduling
jobs.java:6: error: cannot find symbol
    int numRequests = in.nextInt();
                      ^
  symbol:   variable in
  location: class JobScheduling
jobs.java:11: error: cannot find symbol
        log[i] = in.nextInt(); 
                 ^
  symbol:   variable in
  location: class JobScheduling
5 errors

=======