{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"livecodebench","formal_name":"LiveCodeBench","introduction":"LiveCodeBench continuously collects new competitive-programming problems to evaluate coding capabilities. Its initial release_v1 contains 400 problems, with source platform, contest date, and dataset version tracked explicitly.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://livecodebench.github.io/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"b3eee772-de9c-537f-8fd0-5b4f0bf63377","task_key":"release~5fv1--test--2839","task_revision_id":"2","upstream_id":"2839","short_description":"maximum-sum-queries","config":"release_v1","split":"test","body":"{\"contest_date\":\"2023-06-11T00:00:00\",\"contest_id\":\"weekly-contest-349\",\"difficulty\":\"hard\",\"platform\":\"leetcode\",\"question_content\":\"You are given two 0-indexed integer arrays nums1 and nums2, each of length n, and a 1-indexed 2D array queries where queries[i] = [x_i, y_i].\\nFor the i^th query, find the maximum value of nums1[j] + nums2[j] among all indices j (0 <= j < n), where nums1[j] >= x_i and nums2[j] >= y_i, or -1 if there is no j satisfying the constraints.\\nReturn an array answer where answer[i] is the answer to the i^th query.\\n \\nExample 1:\\n\\nInput: nums1 = [4,3,1,2], nums2 = [2,4,9,5], queries = [[4,1],[1,3],[2,5]]\\nOutput: [6,10,7]\\nExplanation: \\nFor the 1st query x_i = 4 and y_i = 1, we can select index j = 0 since nums1[j] >= 4 and nums2[j] >= 1. The sum nums1[j] + nums2[j] is 6, and we can show that 6 is the maximum we can obtain.\\n\\nFor the 2nd query x_i = 1 and y_i = 3, we can select index j = 2 since nums1[j] >= 1 and nums2[j] >= 3. The sum nums1[j] + nums2[j] is 10, and we can show that 10 is the maximum we can obtain. \\n\\nFor the 3rd query x_i = 2 and y_i = 5, we can select index j = 3 since nums1[j] >= 2 and nums2[j] >= 5. The sum nums1[j] + nums2[j] is 7, and we can show that 7 is the maximum we can obtain.\\n\\nTherefore, we return [6,10,7].\\n\\nExample 2:\\n\\nInput: nums1 = [3,2,5], nums2 = [2,3,4], queries = [[4,4],[3,2],[1,1]]\\nOutput: [9,9,9]\\nExplanation: For this example, we can use index j = 2 for all the queries since it satisfies the constraints for each query.\\n\\nExample 3:\\n\\nInput: nums1 = [2,1], nums2 = [2,3], queries = [[3,3]]\\nOutput: [-1]\\nExplanation: There is one query in this example with x_i = 3 and y_i = 3. For every index, j, either nums1[j] < x_i or nums2[j] < y_i. Hence, there is no solution. \\n\\n \\nConstraints:\\n\\nnums1.length == nums2.length \\nn == nums1.length \\n1 <= n <= 10^5\\n1 <= nums1[i], nums2[i] <= 10^9 \\n1 <= queries.length <= 10^5\\nqueries[i].length == 2\\nx_i == queries[i][1]\\ny_i == queries[i][2]\\n1 <= x_i, y_i <= 10^9\",\"question_title\":\"maximum-sum-queries\",\"starter_code\":\"class Solution:\\n    def maximumSumQueries(self, nums1: List[int], nums2: List[int], queries: List[List[int]]) -> List[int]:\\n        \"}","display_format":"text","language":"","answer_status":"external_grader","assets":[],"source_url":"https://livecodebench.github.io/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}