Submission #726268

#TimeUsernameProblemLanguageResultExecution timeMemory
726268jnjwnwnwJob Scheduling (CEOI12_jobs)Java
Compilation error
0 ms0 KiB
import java.util.*; import java.io.*; public class jobs{ class Pairr{ int ind, v; public Pairr(int index, int val){ this.ind = index; this.v = val; } public int compareTo(Pair p){ return this.v - p.v; } } public static void main(String[] args){ new jobs(); } public jobs(){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int d = sc.nextInt(); int m = sc.nextInt(); Pair[] arr = new Pair[m]; for (int i = 0; i < m; i++) { arr[i] = new Pairr(i, sc.nextInt()); } Arrays.sort(arr, (a, b) -> a.compareTo(b)); int ans = (int) Math.ceil(m/(double)(n-d)); System.out.println(ans); int j = 0; for(int i = 0; i < n; i++){ int end = Math.min(m, j + ans); for(; j < end; j++){ if (arr[j].v > i+1){break;} System.out.print(arr[j].ind + 1 + " "); } System.out.println(0); } } }

Compilation message (stderr)

jobs.java:10: error: cannot find symbol
        public int compareTo(Pair p){
                             ^
  symbol:   class Pair
  location: class jobs.Pairr
jobs.java:24: error: cannot find symbol
        Pair[] arr = new Pair[m];
        ^
  symbol:   class Pair
  location: class jobs
jobs.java:24: error: cannot find symbol
        Pair[] arr = new Pair[m];
                         ^
  symbol:   class Pair
  location: class jobs
3 errors