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.
Problems
B'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 x 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. xe2 x80 x89e. 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: 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 <= n <= 2 cdot 10^5 ). The second line contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 10^8 ). The third line contains n integers b_1, b_2, ... , b_n ( 0 <= b_j <= 10^8 ). Print one integer -- the minimum number of coins required to transform the matrix c into the zero matrix. In the first example, the matrix looks as follows: You can turn it into a zero matrix using 2 coins as follows: In the second example, the matrix looks as follows: You can turn it into a zero matrix using 5 coins as follows: '... |
Tutorials
Submissions
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 |
remove filters
Back to search problems