Submission #3617146


Source Code Expand

import java.util.ArrayList;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;
	static boolean[] used;
	static int f = 0;
	static int s = 0;

	static long mod = 1000000007;
	static ArrayList<Integer> saitan;




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		long[] h = new long[n];


		for(int i = 0;i < n;i++){
			h[i] = sc.nextLong();
		}


		long min = 0;
		long max = 1000000000;
		long T = 0;
		int k= 0;

		while(max - min > 1){
			T =( max + min)/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){
				min = T;
			}else{
				max = T;
			}


		}
		System.out.println(max);






	}


}


Submission Info

Submission Time
Task D - Widespread
User oyr
Language Java8 (OpenJDK 1.8.0)
Score 400
Code Size 953 Byte
Status AC
Exec Time 524 ms
Memory 51676 KB

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 19024 KB
a02 AC 94 ms 20692 KB
a03 AC 95 ms 23124 KB
b04 AC 92 ms 21716 KB
b05 AC 505 ms 48400 KB
b06 AC 523 ms 47500 KB
b07 AC 519 ms 51676 KB
b08 AC 522 ms 48528 KB
b09 AC 465 ms 49636 KB
b10 AC 490 ms 46184 KB
b11 AC 512 ms 49992 KB
b12 AC 467 ms 46376 KB
b13 AC 524 ms 50232 KB