Tap here to switch tabs
Problem
Submissions

Problem: Painting the Walls

Try to solve the Painting the Walls problem.

Statement

You are given two integer arrays cost and time of equal length n, which represent the cost and duration needed to paint n distinct walls.

There are two painters available:

  • A paid painter who paints the ithi^{ th} wall in time[i] units of time for cost[i] units of money.

  • A free painter who can paint any wall in 11 unit of time at a cost of 00, but can only work while the paid painter is actively painting a wall.

Return the minimum total cost required to paint all n walls.

Constraints:

  • 1≤1 \leq cost.length ≤500\leq 500

  • cost.length ==== time.length

  • 1≤1 \leq cost[i] ≤106\leq 10^6

  • 1≤1 \leq time[i] ≤500\leq 500

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Painting the Walls

Try to solve the Painting the Walls problem.

Statement

You are given two integer arrays cost and time of equal length n, which represent the cost and duration needed to paint n distinct walls.

There are two painters available:

  • A paid painter who paints the ithi^{ th} wall in time[i] units of time for cost[i] units of money.

  • A free painter who can paint any wall in 11 unit of time at a cost of 00, but can only work while the paid painter is actively painting a wall.

Return the minimum total cost required to paint all n walls.

Constraints:

  • 1≤1 \leq cost.length ≤500\leq 500

  • cost.length ==== time.length

  • 1≤1 \leq cost[i] ≤106\leq 10^6

  • 1≤1 \leq time[i] ≤500\leq 500