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 |
---|---|---|---|---|---|---|
1852 | Codeforces Round 887 (Div. 1) | FINISHED | False | 9000 | 41700299 | July 23, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 169 ) | E | Rivalries | PROGRAMMING | constructive algorithms data structures |
B'Ntarsis has an array a of length n . The power of a subarray a_l ... a_r ( 1 <= q l <= q r <= q n ) is defined as: Call an array b a rival to a if the following holds: Ntarsis wants you to find a rival b to a such that the sum of b_i over 1 <= q i <= q n is maximized. Help him with this task! Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). The description of the test cases follows. The first line of each test case has a single integer n ( 1 <= q n <= q 10^5 ). The next line contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ). It is guaranteed that the sum of n across all test cases does not exceed 2 cdot 10^5 . For each test case, output n integers b_1, b_2, ldots, b_n -- a valid rival to a such that b_1 + b_2 + cdots + b_n is maximal. If there exist multiple rivals with the maximum sum, output any of them. For the first test case, one rival with the maximal sum is [2, 4, 2, 3, 3] . [2, 4, 2, 3, 3] can be shown to be a rival to [1, 4, 1, 3, 3] . All possible subarrays of a and b and their corresponding powers are listed below: It can be shown there exists no rival with a greater sum than 2 + 4 + 2 + 3 + 3 = 14 . '... |
Codeforces Round 887 (Div 1, Div 2) Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
215247415 | Um_nik | E | July 23, 2023, 4:51 p.m. | OK | GNU C++17 | TESTS | 114 | 280 | 9113600 | ||
215240727 | Geothermal | E | July 23, 2023, 4:24 p.m. | OK | GNU C++17 (64) | TESTS | 114 | 342 | 11468800 | ||
215248799 | amiya | E | July 23, 2023, 4:56 p.m. | OK | GNU C++17 (64) | TESTS | 114 | 436 | 22220800 | ||
215237098 | ecnerwala | E | July 23, 2023, 4:11 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 124 | 8089600 | ||
215243658 | tourist | E | July 23, 2023, 4:35 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 155 | 21196800 | ||
215236966 | greenheadstrange | E | July 23, 2023, 4:11 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 171 | 17203200 | ||
215300179 | Hritik12 | E | July 24, 2023, 4:40 a.m. | OK | GNU C++20 (64) | TESTS | 114 | 186 | 17612800 | ||
215255508 | tfg | E | July 23, 2023, 5:51 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 187 | 17612800 | ||
215239122 | Rebelz | E | July 23, 2023, 4:18 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 218 | 11468800 | ||
215296441 | heno239 | E | July 24, 2023, 3:46 a.m. | OK | GNU C++20 (64) | TESTS | 114 | 265 | 28774400 | ||
215245960 | scott_wu | E | July 23, 2023, 4:45 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 327 | 16691200 | ||
215261856 | uchiha2504 | E | July 23, 2023, 6:43 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 358 | 16691200 | ||
215240027 | jiangly | E | July 23, 2023, 4:22 p.m. | OK | GNU C++20 (64) | TESTS | 114 | 358 | 24780800 | ||
215255386 | Tlatoani | E | July 23, 2023, 5:50 p.m. | OK | Kotlin 1.6 | TESTS | 114 | 1325 | 33894400 | ||
215247584 | conqueror_of_tourist | E | July 23, 2023, 4:51 p.m. | OK | PyPy 3-64 | TESTS | 114 | 1949 | 75980800 |
Back to search problems