답안 #361443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
361443 2021-01-30T08:13:25 Z AnythingWithJ Job Scheduling (CEOI12_jobs) Java 11
0 / 100
162 ms 11608 KB
import java.util.*;
import java.io.*;
 
class jobs
//public class scheduling
{
   static String[] names;
   public static void main(String[] args) throws FileNotFoundException
   {
      // Scanner in = new Scanner(new File("scheduling.in"));
      Scanner in = new Scanner(System.in);
      int n = 10;
      /*int n = in.nextInt();
      int d = in.nextInt();
      int m = in.nextInt();
      Request[] array = new Request[m];
      for(int i = 0; i < m; i++)
         array[i] = new Request(i + 1, in.nextInt());*/
      in.close();
      
      // Arrays.sort(array);
      names = new String[n];
      int result = 0;
      // int result = binarySearch(n, d, m, array);
      // works(n, d, m, array, result);
      
      // PrintWriter out = new PrintWriter(new File("scheduling.out"));
      System.out.println(result);
      // out.println(result);
      for(int i = 0; i < n; i++)
      {
         System.out.println(names[i] + "0");
         // out.println(names[i]);
      }
      // out.close();
   }
   static int binarySearch(int n, int d, int m, Request[] array)
   {
      int a = 1;
      int b = m;
      /*while(a != b)
      {
         int mid = (a + b) / 2;
         if(works(n, d, m, array, mid))
            b = mid;
         else
            a = mid + 1;
      }*/
      return a;
   }
   static boolean works(int n, int d, int m, Request[] array, int mid)
   {
      int[] assign = new int[m];
      for(int i = 1; i < m; i++)
         assign[i] = (assign[i - 1] + 1) % mid;
      int[] lastSeen = new int[mid];
      for(int i = 0; i < n; i++)
         names[i] = "";
      
      for(int i = 0; i < m; i++)
      {
         if(lastSeen[assign[i]] + 1 - array[i].day > d)
            return false;  
         if(array[i].day - lastSeen[assign[i]] > 0)
            lastSeen[assign[i]] = array[i].day;
         else
            lastSeen[assign[i]] = lastSeen[assign[i]] + 1;
         if(lastSeen[assign[i]] - 1 > n)
            return false;
         names[lastSeen[assign[i]] - 1] += array[i].index + " ";
      }
      return true;
   }
   static class Request implements Comparable<Request>
   {
      int index, day;
      Request(int index, int day)
      {
         this.index = index;
         this.day = day;
      }
      public int compareTo(Request other)
      {
         return this.day - other.day;
      }
      public String toString()
      {
         return index + ":" + day;
      }
   }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 146 ms 11608 KB Output isn't correct
2 Incorrect 162 ms 11256 KB Output isn't correct
3 Incorrect 152 ms 11372 KB Output isn't correct
4 Incorrect 149 ms 11244 KB Output isn't correct
5 Incorrect 155 ms 11372 KB Output isn't correct
6 Incorrect 156 ms 11108 KB Output isn't correct
7 Incorrect 149 ms 11012 KB Output isn't correct
8 Incorrect 148 ms 11444 KB Output isn't correct
9 Incorrect 152 ms 11244 KB Output isn't correct
10 Incorrect 151 ms 11372 KB Output isn't correct
11 Incorrect 147 ms 11344 KB Output isn't correct
12 Incorrect 150 ms 11244 KB Output isn't correct
13 Incorrect 147 ms 11372 KB Output isn't correct
14 Incorrect 149 ms 11192 KB Output isn't correct
15 Incorrect 150 ms 11368 KB Output isn't correct
16 Incorrect 155 ms 11240 KB Output isn't correct
17 Incorrect 149 ms 11380 KB Output isn't correct
18 Incorrect 147 ms 11432 KB Output isn't correct
19 Incorrect 152 ms 11368 KB Output isn't correct
20 Incorrect 151 ms 11456 KB Output isn't correct