Submission #1157273


Source Code Expand

import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long N = Long.parseLong(scan.next());
		long C = Long.parseLong(scan.next());
		long K = Long.parseLong(scan.next());
		long bus = 0;
		LinkedList<Long> times = new LinkedList<>();
		while(scan.hasNext()) {
			times.add(Long.parseLong(scan.next()));
		}
		Collections.sort(times);
		while(!times.isEmpty()) {
			bus++;
			long end = times.getLast() + K;
			long passNum = 0;
			while(!times.isEmpty() && passNum < C) {
				long time = times.getLast();
				if (time <= end) {
					times.removeLast();
					passNum++;
				}
				else {
					break;
				}
			}
		}
		System.out.println(bus);
	}

}

Submission Info

Submission Time
Task A - Airport Bus
User pytran
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 819 Byte
Status WA
Exec Time 586 ms
Memory 52532 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 2
AC × 3
WA × 9
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 147 ms 21076 KB
in2.txt AC 520 ms 52532 KB
in3.txt WA 575 ms 49560 KB
in4.txt AC 586 ms 48636 KB
in5.txt WA 142 ms 22732 KB
in6.txt WA 548 ms 51348 KB
in7.txt WA 501 ms 48732 KB
in8.txt WA 562 ms 51900 KB
sample1.txt WA 88 ms 21844 KB
sample2.txt WA 89 ms 18900 KB