https://www.acmicpc.net/problem/3079
시간을 이분 탐색해야 하는것까지는 생각해냈는데
무엇과 비교해서 처리해야 할지 생각이 안떠올라서 풀이를 보고 문제를 풀었다
특정 시간안에 몇명까지 처리 가능한지 구해서 비교하면된다
예외처리때문에 시간이 걸렸다
import java.io.*;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N,M;//심사대개수, 사람수
String[] input = br.readLine().split(" ");
N = Integer.parseInt(input[0]);
M = Integer.parseInt(input[1]);
int[] arr = new int[N];
long high = 0;
for(int i = 0; i < N; ++i)
{
arr[i] = Integer.parseInt(br.readLine());
high = Math.max(high, arr[i]);
}
high *= M;
long low = 0;
long can = 0;
long sum = 0;
while((high-low) > 1)
{
can = (high + low) / 2;
sum = 0;
for(int i = 0; i < N; ++i)
{
sum += can /arr[i];
}
if(sum >= M)
{
high = can;
}
else if(sum < M)
{
low = can;
}
}
System.out.println(high);
}
}