FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2318,3 "name": "maximum_points_in_an_archery_competition",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/maximum-points-in-an-archery-competition/",6 "date": "1647129600000",7 "task_description": "Alice and Bob are opponents in an archery competition. The competition has set the following rules: Alice first shoots `numArrows` arrows and then Bob shoots `numArrows` arrows. The points are then calculated as follows: The target has integer scoring sections ranging from `0` to `11` **inclusive**. For **each** section of the target with score `k` (in between `0` to `11`), say Alice and Bob have shot `ak` and `bk` arrows on that section respectively. If `ak >= bk`, then Alice takes `k` points. If `ak < bk`, then Bob takes `k` points. However, if `ak == bk == 0`, then **nobody** takes `k` points. For example, if Alice and Bob both shot `2` arrows on the section with score `11`, then Alice takes `11` points. On the other hand, if Alice shot `0` arrows on the section with score `11` and Bob shot `2` arrows on that same section, then Bob takes `11` points. You are given the integer `numArrows` and an integer array `aliceArrows` of size `12`, which represents the number of arrows Alice shot on each scoring section from `0` to `11`. Now, Bob wants to **maximize** the total number of points he can obtain. Return _the array _`bobArrows`_ which represents the number of arrows Bob shot on **each** scoring section from _`0`_ to _`11`. The sum of the values in `bobArrows` should equal `numArrows`. If there are multiple ways for Bob to earn the maximum total points, return **any** one of them. **Example 1:** ``` **Input:** numArrows = 9, aliceArrows = [1,1,0,1,0,0,2,1,0,1,2,0] **Output:** [0,0,0,0,1,1,0,0,1,2,3,1] **Explanation:** The table above shows how the competition is scored. Bob earns a total point of 4 + 5 + 8 + 9 + 10 + 11 = 47. It can be shown that Bob cannot obtain a score higher than 47 points. ``` **Example 2:** ``` **Input:** numArrows = 3, aliceArrows = [0,0,1,0,0,0,0,0,0,0,0,2] **Output:** [0,0,0,0,0,0,0,0,1,1,1,0] **Explanation:** The table above shows how the competition is scored. Bob earns a total point of 8 + 9 + 10 = 27. It can be shown that Bob cannot obtain a score higher than 27 points. ``` **Constraints:** `1 <= numArrows <= 105` `aliceArrows.length == bobArrows.length == 12` `0 <= aliceArrows[i], bobArrows[i] <= numArrows` `sum(aliceArrows[i]) == numArrows`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "numArrows = 9, aliceArrows = [1,1,0,1,0,0,2,1,0,1,2,0]",12 "output": "[0,0,0,0,1,1,0,0,1,2,3,1] "13 },14 {15 "label": "Example 2",16 "input": "numArrows = 3, aliceArrows = [0,0,1,0,0,0,0,0,0,0,0,2]",17 "output": "[0,0,0,0,0,0,0,0,1,1,1,0] "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 7327,24 [25 5024,26 1281,27 875,28 79,29 22,30 6,31 30,32 5,33 3,34 0,35 0,36 237 ]38 ],39 "output": [40 0,41 1282,42 876,43 80,44 23,45 7,46 31,47 6,48 4,49 1,50 1,51 501652 ]53 },54 {55 "input": [56 21169,57 [58 11398,59 8048,60 894,61 239,62 173,63 284,64 78,65 28,66 5,67 21,68 0,69 170 ]71 ],72 "output": [73 0,74 8049,75 895,76 240,77 174,78 285,79 79,80 29,81 6,82 22,83 1,84 1138985 ]86 },87 {88 "input": [89 92215,90 [91 90650,92 1305,93 215,94 2,95 38,96 4,97 1,98 0,99 0,100 0,101 0,102 0103 ]104 ],105 "output": [106 0,107 1306,108 216,109 3,110 39,111 5,112 2,113 1,114 1,115 1,116 1,117 90640118 ]119 },120 {121 "input": [122 21066,123 [124 2883,125 10299,126 1763,127 2010,128 1435,129 1608,130 572,131 93,132 119,133 153,134 71,135 60136 ]137 ],138 "output": [139 0,140 10300,141 1764,142 2011,143 1436,144 1609,145 573,146 94,147 120,148 154,149 72,150 2933151 ]152 },153 {154 "input": [155 15410,156 [157 12135,158 1876,159 1186,160 31,161 77,162 33,163 62,164 10,165 0,166 0,167 0,168 0169 ]170 ],171 "output": [172 0,173 1877,174 1187,175 32,176 78,177 34,178 63,179 11,180 1,181 1,182 1,183 12125184 ]185 },186 {187 "input": [188 76447,189 [190 69211,191 6849,192 289,193 52,194 44,195 0,196 0,197 1,198 1,199 0,200 0,201 0202 ]203 ],204 "output": [205 0,206 6850,207 290,208 53,209 45,210 1,211 1,212 2,213 2,214 1,215 1,216 69201217 ]218 },219 {220 "input": [221 54503,222 [223 16589,224 9581,225 11400,226 12064,227 1543,228 3205,229 45,230 3,231 47,232 10,233 14,234 2235 ]236 ],237 "output": [238 0,239 9582,240 11401,241 12065,242 1544,243 3206,244 46,245 4,246 48,247 11,248 15,249 16581250 ]251 },252 {253 "input": [254 76989,255 [256 1045,257 46635,258 11368,259 257,260 7394,261 1874,262 1433,263 2922,264 2958,265 1101,266 0,267 2268 ]269 ],270 "output": [271 0,272 46636,273 11369,274 258,275 7395,276 1875,277 1434,278 2923,279 2959,280 1102,281 1,282 1037283 ]284 },285 {286 "input": [287 59368,288 [289 58960,290 239,291 38,292 61,293 29,294 34,295 3,296 3,297 0,298 0,299 0,300 1301 ]302 ],303 "output": [304 0,305 240,306 39,307 62,308 30,309 35,310 4,311 4,312 1,313 1,314 1,315 58951316 ]317 },318 {319 "input": [320 69273,321 [322 59439,323 6843,324 2852,325 73,326 66,327 0,328 0,329 0,330 0,331 0,332 0,333 0334 ]335 ],336 "output": [337 0,338 6844,339 2853,340 74,341 67,342 1,343 1,344 1,345 1,346 1,347 1,348 59429349 ]350 }351 ],352 "haskell_template": "maximumBobPoints :: Int -> [Int] -> [Int]\nmaximumBobPoints numArrows aliceArrows ",353 "ocaml_template": "let maximumBobPoints (numArrows: int) (aliceArrows: int list) : int list = ",354 "scala_template": "def maximumBobPoints(numArrows: Int,aliceArrows: List[Int]): List[Int] = { \n \n}",355 "java_template": "public static List<Integer> maximumBobPoints(int numArrows, List<Integer> aliceArrows) {\n\n}",356 "python_template": "class Solution(object):\n def maximumBobPoints(self, numArrows, aliceArrows):\n \"\"\"\n :type numArrows: int\n :type aliceArrows: List[int]\n :rtype: List[int]\n \"\"\"\n "357}