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'You are given three points with integer coordinates x_1 , x_2 , and x_3 on the X axis ( 1 <= q x_i <= q 10 ). You can choose any point with an integer coordinate a on the X axis. Note that the point a may coincide with x_1 , x_2 , or x_3 . Let f(a) be the total distance from the given points to the point a . Find the smallest value of f(a) . The distance between points a and b is equal to |a - b| . For example, the distance between points a = 5 and b = 2 is 3 . Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10^3 ) -- the number of test cases. Then follows their descriptions. The single line of each test case contains three integers x_1 , x_2 , and x_3 ( 1 <= q x_i <= q 10 ) -- the coordinates of the points. For each test case, output the smallest value of f(a) . In the first test case, the smallest value of f(a) is achieved when a = 1 : f(1) = |1 - 1| + |1 - 1| + |1 - 1| = 0 . In the second test case, the smallest value of f(a) is achieved when a = 5 : f(5) = |1 - 5| + |5 - 5| + |9 - 5| = 8 . In the third test case, the smallest value of f(a) is achieved when a = 8 : f(8) = |8 - 8| + |2 - 8| + |8 - 8| = 6 . In the fourth test case, the smallest value of f(a) is achieved when a = 9 : f(10) = |10 - 9| + |9 - 9| + |3 - 9| = 7 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
267107341 |
Weekoder |
A |
June 23, 2024, 10:48 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267129934 |
xygzy |
A |
June 24, 2024, 5:23 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267122421 |
vjudge3 |
A |
June 24, 2024, 3:50 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267121977 |
PagalavanPagal66 |
A |
June 24, 2024, 3:43 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267121770 |
vjudge.10 |
A |
June 24, 2024, 3:41 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267120140 |
c_siddharth3103 |
A |
June 24, 2024, 3:18 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267116968 |
vipulv_codes |
A |
June 24, 2024, 2:26 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267116346 |
03shree |
A |
June 24, 2024, 2:14 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267110789 |
FanCySummer1 |
A |
June 24, 2024, 12:11 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267110127 |
tiasaha123 |
A |
June 23, 2024, 11:53 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
2 |
30 |
0 |
|
|
267080798 |
Modern |
A |
June 23, 2024, 5:19 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267128761 |
Rhyme3 |
A |
June 24, 2024, 5:08 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267100370 |
ahmedsabry320 |
A |
June 23, 2024, 8:42 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267090600 |
Naman10ap |
A |
June 23, 2024, 6:38 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267090460 |
6AshutoshPrasad9 |
A |
June 23, 2024, 6:37 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267083310 |
Priyanshu_upadhyay |
A |
June 23, 2024, 5:35 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267082745 |
akkshit_19 |
A |
June 23, 2024, 5:31 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267080370 |
ritik108 |
A |
June 23, 2024, 5:16 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
0 |
|
|
267085632 |
HerDaddy |
A |
June 23, 2024, 5:54 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
15 |
183091200 |
|
|
267133357 |
RXT_SKape |
A |
June 24, 2024, 6:01 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
2 |
30 |
0 |
|
|
267096998 |
csibe_csavo |
A |
June 23, 2024, 7:55 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
15 |
0 |
|
|
267120358 |
JustKitkat |
A |
June 24, 2024, 3:21 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
15 |
0 |
|
|
267115556 |
anuj_yadav123 |
A |
June 24, 2024, 1:58 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
15 |
0 |
|
|
267115540 |
newdei |
A |
June 24, 2024, 1:58 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
15 |
0 |
|
|
267085258 |
_As3ad |
A |
June 23, 2024, 5:51 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
15 |
0 |
|
|
267091643 |
MinaMagdy1 |
A |
June 23, 2024, 6:50 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
15 |
48128000 |
|
|
267131880 |
imr_an |
A |
June 24, 2024, 5:45 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
30 |
0 |
|
|
267133317 |
manojvarma |
A |
June 24, 2024, 6:01 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
30 |
0 |
|
|
267132650 |
lundchoder |
A |
June 24, 2024, 5:53 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
30 |
0 |
|
|
267132632 |
vishal05 |
A |
June 24, 2024, 5:53 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
2 |
30 |
0 |
|
|
267104927 |
bluemegane |
A |
June 23, 2024, 10 p.m. |
OK |
C# 8 |
TESTS |
2 |
77 |
102400 |
|
|
267083803 |
Tawfiq007 |
A |
June 23, 2024, 5:39 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
267077618 |
n_affis7 |
A |
June 23, 2024, 5:04 p.m. |
OK |
GNU C11 |
TESTS |
2 |
30 |
0 |
|
|
267127494 |
Tushar-c241156 |
A |
June 24, 2024, 4:52 a.m. |
OK |
GNU C11 |
TESTS |
2 |
30 |
102400 |
|
|
267097793 |
Ilhamx |
A |
June 23, 2024, 8:05 p.m. |
OK |
GNU C11 |
TESTS |
2 |
30 |
102400 |
|
|
267132070 |
loki_3971 |
A |
June 24, 2024, 5:47 a.m. |
OK |
GNU C11 |
TESTS |
2 |
31 |
0 |
|
|
267113508 |
IEluan |
A |
June 24, 2024, 1:15 a.m. |
OK |
GNU C11 |
TESTS |
2 |
31 |
307200 |
|
|
267095381 |
Kususma224 |
A |
June 23, 2024, 7:34 p.m. |
OK |
GNU C11 |
TESTS |
2 |
46 |
0 |
|
|
267091664 |
Ronja7 |
A |
June 23, 2024, 6:50 p.m. |
OK |
GNU C11 |
TESTS |
2 |
46 |
0 |
|
|
267113977 |
nguyenvantan112134 |
A |
June 24, 2024, 1:26 a.m. |
OK |
GNU C11 |
TESTS |
2 |
46 |
102400 |
|
|
267102298 |
crapcode |
A |
June 23, 2024, 9:14 p.m. |
OK |
GNU C11 |
TESTS |
2 |
46 |
102400 |
|
|
267083564 |
1936557 |
A |
June 23, 2024, 5:37 p.m. |
OK |
Haskell |
TESTS |
2 |
46 |
0 |
|
|
267099082 |
Pv2f4n |
A |
June 23, 2024, 8:23 p.m. |
OK |
Java 21 |
TESTS |
2 |
187 |
0 |
|
|
267091539 |
ahadthegreat |
A |
June 23, 2024, 6:49 p.m. |
OK |
Java 21 |
TESTS |
2 |
202 |
0 |
|
|
267082422 |
snehaaadn |
A |
June 23, 2024, 5:29 p.m. |
OK |
Java 21 |
TESTS |
2 |
202 |
819200 |
|
|
267076965 |
21ag1a05g1 |
A |
June 23, 2024, 5:03 p.m. |
OK |
Java 21 |
TESTS |
2 |
218 |
614400 |
|
|
267087709 |
PranavSodani |
A |
June 23, 2024, 6:11 p.m. |
OK |
Java 21 |
TESTS |
2 |
218 |
1126400 |
|
|
267116647 |
goalboy |
A |
June 24, 2024, 2:20 a.m. |
OK |
Java 21 |
TESTS |
2 |
233 |
614400 |
|
|
267127993 |
darshil2208 |
A |
June 24, 2024, 4:58 a.m. |
OK |
Java 21 |
TESTS |
2 |
233 |
819200 |
|
|
267119913 |
anikateagrawal |
A |
June 24, 2024, 3:14 a.m. |
OK |
Java 21 |
TESTS |
2 |
233 |
819200 |
|
|
267099930 |
IBRAAM35 |
A |
June 23, 2024, 8:35 p.m. |
OK |
Java 21 |
TESTS |
2 |
233 |
819200 |
|
|
267119254 |
Ahmed-Ragab-Saad |
A |
June 24, 2024, 3:04 a.m. |
OK |
Java 21 |
TESTS |
2 |
233 |
921600 |
|
|
267128930 |
cccClash |
A |
June 24, 2024, 5:10 a.m. |
OK |
Java 8 |
TESTS |
2 |
124 |
0 |
|
|
267089035 |
yashvardhan3 |
A |
June 23, 2024, 6:23 p.m. |
OK |
Java 8 |
TESTS |
2 |
124 |
0 |
|
|
267115158 |
Dduo |
A |
June 24, 2024, 1:51 a.m. |
OK |
Java 8 |
TESTS |
2 |
155 |
0 |
|
|
267098684 |
msdaks183181 |
A |
June 23, 2024, 8:17 p.m. |
OK |
Java 8 |
TESTS |
2 |
155 |
0 |
|
|
267097427 |
Aparichit_776699 |
A |
June 23, 2024, 8:01 p.m. |
OK |
Java 8 |
TESTS |
2 |
155 |
0 |
|
|
267097110 |
bhishma_v2 |
A |
June 23, 2024, 7:57 p.m. |
OK |
Java 8 |
TESTS |
2 |
155 |
0 |
|
|
267125696 |
prince2245 |
A |
June 24, 2024, 4:30 a.m. |
OK |
Java 8 |
TESTS |
2 |
156 |
0 |
|
|
267121393 |
ankushtyagi |
A |
June 24, 2024, 3:35 a.m. |
OK |
Java 8 |
TESTS |
2 |
156 |
0 |
|
|
267114831 |
toufique_husein |
A |
June 24, 2024, 1:44 a.m. |
OK |
Java 8 |
TESTS |
2 |
171 |
0 |
|
|
267113142 |
bxalgo022 |
A |
June 24, 2024, 1:07 a.m. |
OK |
Java 8 |
TESTS |
2 |
171 |
0 |
|
|
267099186 |
suvmer |
A |
June 23, 2024, 8:24 p.m. |
OK |
JavaScript |
TESTS |
2 |
46 |
409600 |
|
|
267091491 |
WbxOne |
A |
June 23, 2024, 6:48 p.m. |
OK |
Node.js |
TESTS |
2 |
155 |
2150400 |
|
|
267091361 |
___Abdallah___ |
A |
June 23, 2024, 6:47 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
109 |
1433600 |
|
|
267080855 |
karnyadav |
A |
June 23, 2024, 5:19 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
124 |
3584000 |
|
|
267095596 |
Art10em |
A |
June 23, 2024, 7:36 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
124 |
3891200 |
|
|
267084288 |
sathwik11112005 |
A |
June 23, 2024, 5:43 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
139 |
2764800 |
|
|
267128010 |
thinkphp |
A |
June 24, 2024, 4:59 a.m. |
OK |
PyPy 3 |
TESTS |
2 |
140 |
2969600 |
|
|
267116376 |
iPatMini |
A |
June 24, 2024, 2:14 a.m. |
OK |
PyPy 3 |
TESTS |
2 |
155 |
2867200 |
|
|
267089059 |
yerkebulann |
A |
June 23, 2024, 6:23 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
156 |
2457600 |
|
|
267090046 |
taliansky |
A |
June 23, 2024, 6:32 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
156 |
2764800 |
|
|
267106544 |
NitroSpear |
A |
June 23, 2024, 10:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
62 |
1433600 |
|
|
267102847 |
SapperBeret |
A |
June 23, 2024, 9:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1331200 |
|
|
267096663 |
singh.eureka |
A |
June 23, 2024, 7:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1331200 |
|
|
267131848 |
jvatsal0709 |
A |
June 24, 2024, 5:45 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1433600 |
|
|
267099562 |
AndreiZherder |
A |
June 23, 2024, 8:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1433600 |
|
|
267131211 |
athul_v_narayan |
A |
June 24, 2024, 5:37 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1536000 |
|
|
267114768 |
Prabhupada |
A |
June 24, 2024, 1:42 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1536000 |
|
|
267093680 |
mamikonm1 |
A |
June 23, 2024, 7:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1536000 |
|
|
267084767 |
lwrnc788 |
A |
June 23, 2024, 5:47 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1536000 |
|
|
267082813 |
golomb |
A |
June 23, 2024, 5:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
1536000 |
|
|
267108485 |
s83757 |
A |
June 23, 2024, 11:14 p.m. |
OK |
Python 3 |
TESTS |
2 |
46 |
0 |
|
|
267106545 |
TheWicked |
A |
June 23, 2024, 10:31 p.m. |
OK |
Python 3 |
TESTS |
2 |
46 |
0 |
|
|
267101544 |
ahmed14massoud2021 |
A |
June 23, 2024, 9:01 p.m. |
OK |
Python 3 |
TESTS |
2 |
46 |
0 |
|
|
267089281 |
elistark |
A |
June 23, 2024, 6:25 p.m. |
OK |
Python 3 |
TESTS |
2 |
46 |
0 |
|
|
267087197 |
deekshitha.m04 |
A |
June 23, 2024, 6:06 p.m. |
OK |
Python 3 |
TESTS |
2 |
46 |
0 |
|
|
267078811 |
naraink007 |
A |
June 23, 2024, 5:09 p.m. |
OK |
Python 3 |
TESTS |
2 |
46 |
0 |
|
|
267132828 |
IHateRecursion |
A |
June 24, 2024, 5:55 a.m. |
OK |
Python 3 |
TESTS |
2 |
61 |
0 |
|
|
267129514 |
Pranati3 |
A |
June 24, 2024, 5:18 a.m. |
OK |
Python 3 |
TESTS |
2 |
61 |
0 |
|
|
267127717 |
amr_yousef19 |
A |
June 24, 2024, 4:55 a.m. |
OK |
Python 3 |
TESTS |
2 |
61 |
0 |
|
|
267126792 |
amr_yousef19 |
A |
June 24, 2024, 4:43 a.m. |
OK |
Python 3 |
TESTS |
2 |
61 |
0 |
|
|
267089083 |
0x81 |
A |
June 23, 2024, 6:23 p.m. |
OK |
Ruby 3 |
TESTS |
2 |
296 |
1228800 |
|
|
267088238 |
0x81 |
A |
June 23, 2024, 6:16 p.m. |
OK |
Ruby 3 |
TESTS |
2 |
312 |
1331200 |
|
|
267089557 |
0x81 |
A |
June 23, 2024, 6:27 p.m. |
OK |
Ruby 3 |
TESTS |
2 |
343 |
1433600 |
|
|
267118914 |
ElectronApps |
A |
June 24, 2024, 2:58 a.m. |
OK |
Rust 2021 |
TESTS |
2 |
46 |
0 |
|
|
remove filters
Back to search problems