// goodwincommaderek@gmail.com import java.util.Scanner; public class citybike { // assuming we want our number of bikes to always as high as possible static boolean canLowerBoundWork(int dlo, int N, int C, int[] arr) { int bikesHi = C; for (int n=0;n C) { return false; } } return true; } static int solve(int N, int D, int C, int[] arr) { // binary search lowest int lowerBound; { int low = 0, tooHigh = D+1; while (low + 1 < tooHigh) { int mid = low + (tooHigh - low) / 2; boolean isLowEnough = canLowerBoundWork(mid, N, C, arr); if (isLowEnough) { low = mid; } else { tooHigh = mid; } } lowerBound = low; } // binary search highest int upperBound; { int tooLow = -1, high = D; while (tooLow + 1 < high) { int mid = tooLow + (high - tooLow) / 2; boolean isHighEnough = canUpperBoundWork(mid, N, C, arr); if (isHighEnough) { high = mid; } else { tooLow = mid; } } upperBound = high; } int ans = Math.max(0, upperBound - lowerBound); return ans; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int D = in.nextInt(); int C = in.nextInt(); int[] arr = new int[N]; for(int n=0;n