C# || Solution
\npublic class Solution\n{\n    public int MinimumTime(IList<int> nums1, IList<int> nums2, int x)\n    {\n        var n = nums1.Count;\n\n        var p = Enumer
```\npublic class Solution\n{\n    public int MinimumTime(IList<int> nums1, IList<int> nums2, int x)\n    {\n        var n = nums1.Count;\n\n        var p = Enumerable.Range(0, n)\n            .Select(i => (a:nums1[i], b:nums2[i]))\n            .OrderBy(t => t.b)\n            .ToList();\n\n        var dp = new int[n + 1];\n\n        foreach (var (a, b) in p)\n            for (var i = n - 1; i >= 0; i--)\n                dp[i + 1] = Math.Max(dp[i + 1], dp[i] + (i + 1) * b + a);\n\n        var s1 = nums1.Sum();\n        var s2 = nums2.Sum();\n\n        for (var i = 0; i <= n; i++)\n            if (s2 * i + s1 - dp[i] <= x)\n                return i;\n\n        return -1;\n    }\n}\n\n```
['C#']