답안 #292409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
292409 2020-09-06T22:32:42 Z R3KT Job Scheduling (CEOI12_jobs) Java 11
0 / 100
1000 ms 65548 KB
import java.util.*;
import java.io.*;

public class jobs {

	// https://oj.uz/problem/view/CEOI12_jobs
	
	// TLE && RTE
	public static void main(String[] args) throws IOException, FileNotFoundException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//BufferedReader in = new BufferedReader(new FileReader("jobs"));

		StringTokenizer st = new StringTokenizer(in.readLine());
		int n = Integer.parseInt(st.nextToken());
		int d = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());

		obj[] arr = new obj[m];
		st = new StringTokenizer(in.readLine());
		for (int i=0; i<m; ++i) {
			int v = Integer.parseInt(st.nextToken());
			arr[i] = new obj(v, i+1);
		}
		Arrays.sort(arr);
		
		/*
		int min=0;
		int max=m;
		while (min < max) {
			int middle = (min + max)/2;
			if (check(arr, middle, d, n)) {
				max = middle;
			}
			else min = middle+1;
		}
		
		System.out.println(min);
		// construct
		int count=1;
		for (int i=0; i<m; i+=min) {
			for (int j=i; j<i+min && j<m; j++) {
				System.out.print(arr[j].pos + " ");
			}
			System.out.println(0);
			count++;
		}
		for (int i=count; i<=n; i++) System.out.println(0);
		*/
	}
	
	public static boolean check(obj[] arr, int num, int d, int n) {
		int pointer=0;
		int m = arr.length;
		for (int i=1; i<=n; i++) {
			if (pointer>=m) break;
			if (i - arr[pointer].val > d) return false;
			pointer += num;
		}
		if (pointer < m) return false;
		return true;
	}
	
	static class obj implements Comparable<obj> {
		int pos;
		int val;
		obj (int a, int b) {
			val = a;
			pos = b;
		}
		
		public int compareTo(obj other) {
			return val - other.val;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 245 ms 24120 KB Unexpected end of file - int32 expected
2 Incorrect 215 ms 23500 KB Unexpected end of file - int32 expected
3 Incorrect 213 ms 23312 KB Unexpected end of file - int32 expected
4 Incorrect 216 ms 23924 KB Unexpected end of file - int32 expected
5 Incorrect 213 ms 23336 KB Unexpected end of file - int32 expected
6 Incorrect 213 ms 23288 KB Unexpected end of file - int32 expected
7 Incorrect 221 ms 23388 KB Unexpected end of file - int32 expected
8 Incorrect 246 ms 23300 KB Unexpected end of file - int32 expected
9 Incorrect 312 ms 24356 KB Unexpected end of file - int32 expected
10 Incorrect 358 ms 24960 KB Unexpected end of file - int32 expected
11 Incorrect 388 ms 27340 KB Unexpected end of file - int32 expected
12 Runtime error 739 ms 40180 KB Memory limit exceeded
13 Execution timed out 1132 ms 61588 KB Time limit exceeded
14 Execution timed out 1010 ms 63912 KB Time limit exceeded
15 Execution timed out 1286 ms 64904 KB Time limit exceeded
16 Runtime error 424 ms 65544 KB Execution killed with signal 9
17 Runtime error 393 ms 65548 KB Execution killed with signal 9
18 Runtime error 412 ms 65544 KB Execution killed with signal 9
19 Runtime error 409 ms 65548 KB Execution killed with signal 9
20 Runtime error 426 ms 65540 KB Execution killed with signal 9