Sort by

recency

|

10 Discussions

|

  • + 0 comments

    Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Oil Well Problem Solution

  • + 0 comments

    Here is Oil Well problem solution in Python Java C++ and C programming - https://programs.programmingoneonone.com/2021/07/hackerrank-oil-well-problem-solution.html

  • + 0 comments

    Python 3 solution

    r, c = map(int, input().strip().split())
    n = max(r, c)
    g = [[0] * n for i in range(n)]
    for i in range(r):
        bs = list(map(int, input().strip().split()))
        for j in range(c):
            g[i][j] = bs[j]
    x = [[0] * (n + 1) for i in range(n + 1)]
    for i in range(n):
        for j in range(n):
            x[i + 1][j + 1] = x[i + 1][j] + x[i][j + 1] - x[i][j] + g[i][j]
    fs  = g
    fz  = [[0] * n for i in range(n)]
    ans = [[0] * n for i in range(n)]
    anz = [[0] * n for i in range(n)]
    for d in range(1, n):
        for i in range(n - d):
            I = i + d + 1
            for j in range(n-d):
                J = j + d + 1
                total = fz[i][j] = x[I][J] - x[i][J] - x[I][j] + x[i][j]
                anz[i][j] = min(
                    ans[i][j] + d * (total - fs[i][j]),
                    ans[i][j + 1] + d * (total - fs[i][j + 1]),
                    ans[i + 1][j] + d * (total - fs[i + 1][j]),
                    ans[i + 1][j + 1] + d*(total - fs[i + 1][j + 1]))
        ans, anz = anz, ans
        fs, fz =  fz, fs
    print(ans[0][0])
    
  • + 0 comments

    If I'm wrong, please alert me but Calculations in the explanation section are given wrong. The following calculations must be 3 but they were calculated as 4:

    (3, 3) (1, 1) (2, 1) ==> cost = 0 + 2 + 2 = 4 (3, 3) (2, 1) (1, 1) ==> cost = 0 + 2 + 2 = 4

    am I doing an error?

  • [deleted]
    + 1 comment

    So the ACME distance is the induced metric of the infinity/maximum norm for a two dimensional vector space.

    Apparently also called Chebyshev distance.

    • + 0 comments

      The Prezzo menu in the UK offers a diverse selection of dishes, with prices that cater to various tastes and preferences. From classic Italian pasta dishes like Spaghetti Bolognese ,prezzo menu with prices 2023 and Carbonara to gourmet pizzas such as the Margherita and Pollo Pesto, Prezzo provides a range of options to satisfy every appetite.