Submission #1370946


Source Code Expand

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N , K = 0;
		long A, B;
		N = sc.nextInt();
		A = sc.nextLong();
		B = sc.nextLong();
		long[] H = new long[N];
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		long Tmax = 1000000000;
		long Tmin = 0;
		long T = 0;
		while(Tmax-Tmin > 1){
			T = Tmin + (Tmax-Tmin)/2;
			K = 0;
			for(int i = 0 ; i < N ; i++){
				if(H[i] > B*T){
					K += Math.ceil((double)(H[i] - B*T) / (double)(A - B));
				}
			}
			
			if(K > T){
				Tmin = T;
			}
			else if(K <= T){
				Tmax = T;
			}
		}
		System.out.println(Tmax);
	}
}

Submission Info

Submission Time
Task D - Widespread
User xsun4231
Language Java8 (OpenJDK 1.8.0)
Score 400
Code Size 696 Byte
Status AC
Exec Time 535 ms
Memory 58772 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
a01 AC 96 ms 17620 KiB
a02 AC 94 ms 17108 KiB
a03 AC 93 ms 19912 KiB
b04 AC 95 ms 21332 KiB
b05 AC 505 ms 46076 KiB
b06 AC 535 ms 46684 KiB
b07 AC 463 ms 49076 KiB
b08 AC 479 ms 47344 KiB
b09 AC 502 ms 55324 KiB
b10 AC 472 ms 50124 KiB
b11 AC 491 ms 50816 KiB
b12 AC 494 ms 51480 KiB
b13 AC 525 ms 58772 KiB