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 |
---|---|---|---|---|---|---|
1491 | Codeforces Global Round 13 | FINISHED | False | 10800 | 117303899 | Feb. 28, 2021, 1:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 13844 ) | B | Minimal Cost | PROGRAMMING | brute force greedy implementation math |
B"There is a graph of n rows and 10^6 + 2 columns, where rows are numbered from 1 to n and columns from 0 to 10^6 + 1 : Let's denote the node in the row i and column j by (i, j) . Initially for each i the i -th row has exactly one obstacle -- at node (i, a_i) . You want to move some obstacles so that you can reach node (n, 10^6+1) from node (1, 0) by moving through edges of this graph (you can't pass through obstacles). Moving one obstacle to an adjacent by edge free node costs u or v coins, as below: Refer to the picture above for a better understanding. Now you need to calculate the minimal number of coins you need to spend to be able to reach node (n, 10^6+1) from node (1, 0) by moving through edges of this graph without passing through obstacles. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains three integers n , u and v ( 2 <= n <= 100 , 1 <= u, v <= 10^9 ) -- the number of rows in the graph and the numbers of coins needed to move vertically and horizontally respectively. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^6 ) -- where a_i represents that the obstacle in the i -th row is in node (i, a_i) . It's guaranteed that the sum of n over all test cases doesn't exceed 2 cdot 10^4 . For each test case, output a single integer -- the minimal number of coins you need to spend to be able to reach node (n, 10^6+1) from node (1, 0) by moving through edges of this graph without passing through obstacles. It can be shown that under the constraints of the problem there is always a way to make such a trip possible. In the first sample, two obstacles are at (1, 2) and (2,2) . You can move the obstacle on (2, 2) "... |
Codeforces Global Round 13 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
108772491 | TheNewJessPro | B | March 1, 2021, 5:40 a.m. | OK | Clang++17 Diagnostics | TESTS | 20 | 139 | 0 | ||
108772452 | TheNewJessPro | B | March 1, 2021, 5:39 a.m. | OK | Clang++17 Diagnostics | TESTS | 20 | 155 | 0 | ||
108764480 | 1473439561pp | B | March 1, 2021, 2:18 a.m. | OK | Clang++17 Diagnostics | TESTS | 20 | 155 | 0 | ||
108772159 | TheNewJessPro | B | March 1, 2021, 5:35 a.m. | OK | Clang++17 Diagnostics | TESTS | 20 | 155 | 4300800 | ||
108772311 | TheNewJessPro | B | March 1, 2021, 5:37 a.m. | OK | Clang++17 Diagnostics | TESTS | 20 | 171 | 4300800 | ||
108737075 | ntat000 | B | Feb. 28, 2021, 4:11 p.m. | OK | FPC | TESTS | 20 | 46 | 0 | ||
108768375 | mofianger | B | March 1, 2021, 4:23 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108768201 | Gaomez | B | March 1, 2021, 4:18 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108767628 | Carls | B | March 1, 2021, 4:01 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108766678 | HOJQVFNA | B | March 1, 2021, 3:34 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108766170 | luogu_bot2 | B | March 1, 2021, 3:18 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108771700 | largecube233 | B | March 1, 2021, 5:26 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108771222 | luogu_bot5 | B | March 1, 2021, 5:18 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108769636 | scimoon | B | March 1, 2021, 4:54 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108769038 | Comet_Honeymoon | B | March 1, 2021, 4:40 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108768930 | chunlin | B | March 1, 2021, 4:37 a.m. | OK | GNU C++11 | TESTS | 20 | 15 | 0 | ||
108770305 | sakapon | B | March 1, 2021, 5:08 a.m. | OK | .NET Core C# | TESTS | 20 | 93 | 2764800 |
Back to search problems