Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 1983 | Codeforces Round 956 (Div. 2) and ByteRace 2024 | FINISHED | False | 8100 | 56042723 | July 7, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 2460 ) | E | I Love Balls | PROGRAMMING | combinatorics math probabilities |
Alice and Bob are playing a game. There are (n) balls, out of which (k) are special. Each ball has a value associated with it. The players play turn by turn. In each turn, the player randomly picks a ball and adds the value of the ball to their score, which is (0) at the beginning of the game. The selected ball is removed from the game. If the ball was special, the same player takes the next turn if at least one ball is remaining. If the ball picked was not special, the next player plays their turn. They play this game until no balls are remaining in the game. Alice plays first. Find the expected score that both the players have at the end of the game modulo (10^9+7). Formally, let (M = 10^9+7). It can be shown that the answer can be expressed as an irreducible fraction (\frac{p}{q}), where (p) and (q) are integers and (q \not \equiv 0 \pmod{M}). Output the integer equal to (p \cdot q^{-1} \bmod M). In other words, output such an integer (x) that (0 \le x < M) and (x \cdot q \equiv p \pmod{M}). There are multiple test cases. The first line of the input contains an integer (t), the number of test cases ((1 \le t \le 2 \cdot 10^5)). Each test case description is on a new line. The first line of the test case contains two integers (n) and (k) in the respective order separated by a space ((1 \le k \le n \le 4 \cdot 10^5)). The second line of the test case contains (n) integers: (v_1, v_2, \ldots, v_n), the value for each ball separated by spaces. The first (k) balls are special ((1 \le v_i \le 10^7)). The sum of (n) over all test cases does not exceed (5 \cdot 10^5). Output two integers per test case in a new line, the expected score of Alice and the expected score of Bob modulo (10^9+7). In the first test case, Alice's expected score is (45), and Bob's is (30) at the end of the game. |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 269357061 | cbdsopa | E | July 8, 2024, 5:47 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 265 | 6451200 | ||
| 269330348 | xcc_szy09051 | E | July 8, 2024, 12:41 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 265 | 7270400 | ||
| 269293401 | _starling_ | E | July 7, 2024, 4:49 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 296 | 6041600 | ||
| 269288046 | diandian2020 | E | July 7, 2024, 4:36 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 312 | 3276800 | ||
| 269330675 | juruoA | E | July 8, 2024, 12:47 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 327 | 9625600 | ||
| 269293873 | Rigel__ | E | July 7, 2024, 4:49 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 343 | 1638400 | ||
| 269290306 | NusGhy | E | July 7, 2024, 4:42 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 405 | 1638400 | ||
| 269298506 | Sloan_oneyy | E | July 7, 2024, 5:56 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 405 | 7987200 | ||
| 269331685 | RX93 | E | July 8, 2024, 1:04 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 436 | 6451200 | ||
| 269337187 | taozhilin | E | July 8, 2024, 2:14 a.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 437 | 3276800 | ||
| 269290582 | jmao142857 | E | July 7, 2024, 4:42 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 233 | 0 | ||
| 269286881 | xu826281112 | E | July 7, 2024, 4:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 233 | 12185600 | ||
| 269332589 | Zik_ | E | July 8, 2024, 1:17 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 234 | 0 | ||
| 269298735 | a6z | E | July 7, 2024, 5:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 249 | 0 | ||
| 269302137 | downfall | E | July 7, 2024, 6:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 264 | 0 | ||
| 269302360 | rsegvic | E | July 7, 2024, 6:19 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 265 | 3174400 | ||
| 269298907 | GALA | E | July 7, 2024, 5:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 265 | 6144000 | ||
| 269350967 | 749291 | E | July 8, 2024, 4:46 a.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 265 | 7884800 | ||
| 269298996 | tfgs | E | July 7, 2024, 5:58 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 280 | 9216000 | ||
| 269290924 | Wizard_of_Orz | E | July 7, 2024, 4:44 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 296 | 1638400 | ||
| 269305637 | maspy | E | July 7, 2024, 6:45 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 77 | 307200 | ||
| 269284974 | plast | E | July 7, 2024, 4:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 155 | 3276800 | ||
| 269345781 | Golem__ | E | July 8, 2024, 3:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 156 | 1843200 | ||
| 269348873 | DuongForeverAlone | E | July 8, 2024, 4:19 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 171 | 0 | ||
| 269341189 | Jlyfish | E | July 8, 2024, 2:58 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 171 | 0 | ||
| 269337122 | cjoa | E | July 8, 2024, 2:14 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 171 | 102400 | ||
| 269353438 | neal | E | July 8, 2024, 5:11 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 171 | 3993600 | ||
| 269323555 | vjudge.7 | E | July 7, 2024, 10:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 186 | 0 | ||
| 269339534 | ftiasch | E | July 8, 2024, 2:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 186 | 102400 | ||
| 269308566 | Sakuya_maid | E | July 7, 2024, 7:12 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 186 | 7987200 | ||
| 269351138 | Orange905 | E | July 8, 2024, 4:48 a.m. | OK | Java 21 | TESTS | 20 | 311 | 4403200 | ||
| 269350979 | Orange905 | E | July 8, 2024, 4:46 a.m. | OK | Java 21 | TESTS | 20 | 327 | 4915200 | ||
| 269351958 | Orange905 | E | July 8, 2024, 4:58 a.m. | OK | Java 21 | TESTS | 20 | 343 | 5324800 | ||
| 269351369 | Orange905 | E | July 8, 2024, 4:51 a.m. | OK | Java 21 | TESTS | 20 | 359 | 5427200 | ||
| 269320434 | Orange905 | E | July 7, 2024, 9:38 p.m. | OK | Java 21 | TESTS | 20 | 390 | 4403200 | ||
| 269348683 | sagbis | E | July 8, 2024, 4:16 a.m. | OK | Java 21 | TESTS | 20 | 546 | 5939200 | ||
| 269318889 | henryz | E | July 7, 2024, 9:15 p.m. | OK | Java 21 | TESTS | 20 | 609 | 6451200 | ||
| 269288683 | Dukkha | E | July 7, 2024, 4:38 p.m. | OK | Java 21 | TESTS | 20 | 1530 | 7168000 | ||
| 269330748 | dzhi | E | July 8, 2024, 12:49 a.m. | OK | Java 21 | TESTS | 20 | 1937 | 11059200 | ||
| 269286660 | profchi | E | July 7, 2024, 4:32 p.m. | OK | Java 8 | TESTS | 20 | 374 | 13926400 | ||
| 269310725 | ow3nL | E | July 7, 2024, 7:36 p.m. | OK | PyPy 3-64 | TESTS | 20 | 405 | 47616000 | ||
| 269306691 | iedfa | E | July 7, 2024, 6:54 p.m. | OK | PyPy 3-64 | TESTS | 20 | 421 | 50483200 | ||
| 269302055 | jgs03177 | E | July 7, 2024, 6:17 p.m. | OK | PyPy 3-64 | TESTS | 20 | 467 | 50380800 | ||
| 269290475 | 00zijian | E | July 7, 2024, 4:42 p.m. | OK | PyPy 3-64 | TESTS | 20 | 499 | 62873600 | ||
| 269341718 | 429d51579a491c57 | E | July 8, 2024, 3:04 a.m. | OK | PyPy 3-64 | TESTS | 20 | 578 | 33689600 | ||
| 269302073 | helli5.tech | E | July 7, 2024, 6:17 p.m. | OK | PyPy 3-64 | TESTS | 20 | 953 | 50483200 | ||
| 269356741 | PROELECTRO444 | E | July 8, 2024, 5:44 a.m. | OK | PyPy 3-64 | TESTS | 20 | 1234 | 45875200 | ||
| 269349612 | neov5 | E | July 8, 2024, 4:29 a.m. | OK | PyPy 3-64 | TESTS | 20 | 1296 | 41779200 | ||
| 269289178 | alxwen711 | E | July 7, 2024, 4:39 p.m. | OK | PyPy 3-64 | TESTS | 20 | 1484 | 41164800 | ||
| 269313195 | fireSlayer57 | E | July 7, 2024, 8:03 p.m. | OK | PyPy 3-64 | TESTS | 20 | 1812 | 50790400 | ||
| 269318820 | cottoncotton | E | July 7, 2024, 9:14 p.m. | OK | Rust 2021 | TESTS | 20 | 124 | 0 | ||
| 269312551 | scanhex | E | July 7, 2024, 7:57 p.m. | OK | Rust 2021 | TESTS | 20 | 562 | 0 |
Back to search problems