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 |
|---|---|---|---|---|---|---|
| 1765 | 2022-2023 ICPC, NERC, Southern and Volga Russian Regional Contest (Online Mirror, ICPC Rules, Preferably Teams) | FINISHED | False | 18000 | 106946684 | Nov. 27, 2022, 10:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 305 ) | J | Hero to Zero | PROGRAMMING | graph matchings | 2900 |
There are no heroes in this problem. I guess we should have named it "To Zero". You are given two arrays (a) and (b), each of these arrays contains (n) non-negative integers. Let (c) be a matrix of size (n \times n) such that (c_{i,j} = |a_i - b_j|) for every (i \in 1, n) and every (j \in 1, n). Your goal is to transform the matrix (c) so that it becomes the zero matrix, i. e. a matrix where every element is exactly (0). In order to do so, you may perform the following operations any number of times, in any order: choose an integer (i), then decrease (c_{i,j}) by (1) for every (j \in 1, n) (i. e. decrease all elements in the (i)-th row by (1)). In order to perform this operation, you pay (1) coin; choose an integer (j), then decrease (c_{i,j}) by (1) for every (i \in 1, n) (i. e. decrease all elements in the (j)-th column by (1)). In order to perform this operation, you pay (1) coin; choose two integers (i) and (j), then decrease (c_{i,j}) by (1). In order to perform this operation, you pay (1) coin; choose an integer (i), then increase (c_{i,j}) by (1) for every (j \in 1, n) (i. e. increase all elements in the (i)-th row by (1)). When you perform this operation, you receive (1) coin; choose an integer (j), then increase (c_{i,j}) by (1) for every (i \in 1, n) (i. e. increase all elements in the (j)-th column by (1)). When you perform this operation, you receive (1) coin. You have to calculate the minimum number of coins required to transform the matrix (c) into the zero matrix. Note that all elements of (c) should be equal to (0) simultaneously after the operations. The first line contains one integer (n) ((2 \le n \le 2 \cdot 10^5)). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((0 \le a_i \le 10^8)). The third line contains $ |
| 109642 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 182912657 | Zappeko errorgorn rama_pang | J | Nov. 27, 2022, 1:53 p.m. | OK | GNU C++17 | TESTS | 90 | 156 | 3174400 | 2900 | |
| 182945187 | L0TUS | J | Nov. 27, 2022, 7:34 p.m. | OK | GNU C++17 | TESTS | 90 | 156 | 4812800 | 2900 | |
| 182889401 | Merkurev Um_nik | J | Nov. 27, 2022, 12:07 p.m. | OK | GNU C++17 | TESTS | 90 | 171 | 3276800 | 2900 | |
| 182947244 | Karuna | J | Nov. 27, 2022, 8:08 p.m. | OK | GNU C++17 (64) | TESTS | 90 | 108 | 1638400 | 2900 | |
| 182908236 | gisp_zjz triple__a Roundgod | J | Nov. 27, 2022, 1:19 p.m. | OK | GNU C++17 (64) | TESTS | 90 | 109 | 4812800 | 2900 | |
| 182774299 | Maripium jefrai nvmdava | J | Nov. 27, 2022, 11:39 a.m. | OK | GNU C++17 (64) | TESTS | 90 | 109 | 4812800 | 2900 | |
| 182958575 | Benq | J | Nov. 28, 2022, 12:36 a.m. | OK | GNU C++17 (64) | TESTS | 90 | 140 | 9011200 | 2900 | |
| 182929476 | Gary2005 | J | Nov. 27, 2022, 4:21 p.m. | OK | GNU C++20 (64) | TESTS | 90 | 93 | 1638400 | 2900 | |
| 182917170 | 353cerega Batrr | J | Nov. 27, 2022, 2:29 p.m. | OK | GNU C++20 (64) | TESTS | 90 | 93 | 3174400 | 2900 | |
| 182920151 | LeoPro fastmath turmax | J | Nov. 27, 2022, 2:55 p.m. | OK | GNU C++20 (64) | TESTS | 90 | 93 | 6451200 | 2900 | |
| 182959181 | njwrz | J | Nov. 28, 2022, 12:58 a.m. | OK | GNU C++20 (64) | TESTS | 90 | 124 | 9625600 | 2900 | |
| 182901128 | changruinian2020 feecIe6418 gyh20 | J | Nov. 27, 2022, 12:27 p.m. | OK | GNU C++20 (64) | TESTS | 90 | 217 | 14745600 | 2900 | |
| 182911140 | arvindf232 | J | Nov. 27, 2022, 1:41 p.m. | OK | Kotlin 1.6 | TESTS | 90 | 436 | 25395200 | 2900 |
Back to search problems