• Time limit: 1.00 s
  • Memory limit: 512 MB

While participating on this Competitive Programming course, Maija is trying to solve the task wk1 wednesday problem Entrepreneur. To solve this problem, she has a clever idea: use floating point numbers to calculate the estimated time to create t cars. The result will be a floating point number, but she will then check every whole number in the vicinity to find the optimal result.

Input

  • No input

Output

Your program should output a test case where Maija's solution fails.

Constraints (of your output)

  • 1 \le n \le 2 \cdot 10^5
  • 1 \le t \le 10^9
  • 1 \le k_i \le 10^9

Maija's code

#include <bits/stdc++.h>
using namespace std;
#define int long long

vector<int> machines;
int required;
bool doesWork(int time)
{
    int produced = 0;
    for(int i = 0; i < machines.size(); i++)
        produced += time / machines[i];
    return produced >= required;
}
 
signed main() {
    int n;
    cin >> n >> required;

    machines = vector<int>(n);
    for (int i = 0; i < n; i++)
        cin >> machines[i];
    int minimum_element = *std::min_element(machines.begin(), machines.end());

    // Calculate estimate heuristic
    double carsPerSecond = 0;
    for (int i = 0; i < n; i++)
        carsPerSecond += 1.0 / machines[i];
    int estimate = required / carsPerSecond;
    estimate = std::max(estimate, minimum_element);

    // Find the result by adjusting the estimate
    while (doesWork(estimate) && estimate > 0)
        estimate--;
    while (!doesWork(estimate))
        estimate++;
    cout << estimate << endl;
}