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 |
---|---|---|---|---|---|---|
1934 | Codeforces Round 931 (Div. 2) | FINISHED | False | 7200 | 22519499 | March 1, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 25518 ) | A | Too Min Too Max | PROGRAMMING | constructive algorithms greedy math |
B'Given an array a of n elements, find the maximum value of the expression: |a_i - a_j| + |a_j - a_k| + |a_k - a_l| + |a_l - a_i| where i , j , k , and l are four distinct indices of the array a , with 1 <= i, j, k, l <= n . Here |x| denotes the absolute value of x . The first line contains one integer t ( 1 <= t <= 500 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 4 <= n <= 100 ) -- the length of the given array. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( -10^6 <= a_i <= 10^6 ). For each test case, print a single integer -- the maximum value. In the first test case, for any selection of i , j , k , l , the answer will be 0 . For example, |a_1 - a_2| + |a_2 - a_3| + |a_3 - a_4| + |a_4 - a_1| = |1 - 1| + |1 - 1| + |1 - 1| + |1 - 1| = 0 + 0 + 0 + 0 = 0 . In the second test case, for i = 1 , j = 3 , k = 2 , and l = 5 , the answer will be 6 . |a_1 - a_3| + |a_3 - a_2| + |a_2 - a_5| + |a_5 - a_1| = |1 - 2| + |2 - 1| + |1 - 3| + |3 - 1| = 1 + 1 + 2 + 2 = 6 . '... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
249248802 | qwqIdontHaveAgf | A | March 2, 2024, 5:31 a.m. | OK | C# 10 | TESTS | 6 | 61 | 2969600 | ||
249190040 | Suman_Mandol | A | March 1, 2024, 6:19 p.m. | OK | C# 10 | TESTS | 6 | 61 | 3276800 | ||
249216376 | bluemegane | A | March 1, 2024, 10:01 p.m. | OK | C# 8 | TESTS | 6 | 140 | 3072000 | ||
249188035 | satansentmehere | A | March 1, 2024, 6:08 p.m. | OK | Clang++17 Diagnostics | TESTS | 6 | 233 | 0 | ||
249247564 | aloha3492146320 | A | March 2, 2024, 5:22 a.m. | OK | Clang++20 Diagnostics | TESTS | 6 | 217 | 0 | ||
249207479 | safbro12 | A | March 1, 2024, 8:25 p.m. | OK | Clang++20 Diagnostics | TESTS | 6 | 217 | 0 | ||
249239086 | mallhw | A | March 2, 2024, 4:07 a.m. | OK | Clang++20 Diagnostics | TESTS | 6 | 218 | 7372800 | ||
249171196 | ARS12 | A | March 1, 2024, 4:33 p.m. | OK | GNU C11 | TESTS | 6 | 15 | 0 | ||
249188972 | akash_231020408 | A | March 1, 2024, 6:13 p.m. | OK | GNU C11 | TESTS | 6 | 30 | 307200 | ||
249188128 | priyansh0506 | A | March 1, 2024, 6:08 p.m. | OK | GNU C11 | TESTS | 6 | 31 | 0 | ||
249200656 | atharvatol04 | A | March 1, 2024, 7:28 p.m. | OK | GNU C11 | TESTS | 6 | 31 | 307200 | ||
249170685 | Druva_21 | A | March 1, 2024, 4:32 p.m. | OK | GNU C11 | TESTS | 6 | 31 | 307200 | ||
249179470 | Sanjida_Riti | A | March 1, 2024, 5:22 p.m. | OK | GNU C++17 | TESTS | 6 | 0 | 0 | ||
249188396 | Harshitx08 | A | March 1, 2024, 6:09 p.m. | OK | GNU C++17 | TESTS | 6 | 0 | 0 | ||
249211976 | Jahirul_if | A | March 1, 2024, 9:09 p.m. | OK | GNU C++17 | TESTS | 6 | 0 | 0 | ||
249249830 | ElPedrangas03 | A | March 2, 2024, 5:39 a.m. | OK | GNU C++17 | TESTS | 6 | 0 | 0 | ||
249252411 | H_Lloris | A | March 2, 2024, 5:58 a.m. | OK | GNU C++17 | TESTS | 6 | 0 | 0 | ||
249184870 | ALreadY__BrokeN | A | March 1, 2024, 5:49 p.m. | OK | GNU C++17 | TESTS | 6 | 0 | 0 | ||
249198741 | Savoura | A | March 1, 2024, 7:15 p.m. | OK | GNU C++17 | TESTS | 6 | 0 | 102400 | ||
249185098 | JunayedJasim | A | March 1, 2024, 5:50 p.m. | OK | GNU C++17 | TESTS | 6 | 0 | 204800 | ||
249250705 | qriyadh | A | March 2, 2024, 5:45 a.m. | OK | GNU C++17 | TESTS | 6 | 15 | 0 | ||
249249150 | ljjkr | A | March 2, 2024, 5:34 a.m. | OK | GNU C++17 | TESTS | 6 | 15 | 0 | ||
249228844 | hnust_lizhongyu | A | March 2, 2024, 2:07 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 0 | ||
249225995 | 9527_ | A | March 2, 2024, 1:15 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 0 | ||
249181824 | Lazy_Mario | A | March 1, 2024, 5:32 p.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 0 | ||
249245588 | aspirers02 | A | March 2, 2024, 5:07 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 0 | ||
249224312 | LS666 | A | March 2, 2024, 12:43 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 819200 | ||
249246520 | luogu_bot2 | A | March 2, 2024, 5:14 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 7987200 | ||
249233534 | Kaqin | A | March 2, 2024, 3:12 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 0 | 7987200 | ||
249251648 | PurpleCrayon | A | March 2, 2024, 5:52 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 15 | 0 | ||
249251565 | manishjha91 | A | March 2, 2024, 5:51 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 15 | 0 | ||
249250869 | fzyz2020 | A | March 2, 2024, 5:46 a.m. | OK | GNU C++17 (64) | TESTS | 6 | 15 | 0 | ||
249216698 | Royal_Guard_S | A | March 1, 2024, 10:06 p.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249214937 | Sara_Elgazaly | A | March 1, 2024, 9:43 p.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249210151 | Kerb9_ | A | March 1, 2024, 8:50 p.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249201081 | Ragnar-Lodbrok | A | March 1, 2024, 7:32 p.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249197401 | sh_sho1kat | A | March 1, 2024, 7:05 p.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249225722 | Jiaye. | A | March 2, 2024, 1:09 a.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249228507 | orange. | A | March 2, 2024, 2:01 a.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249231688 | cpEverywhere | A | March 2, 2024, 2:52 a.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249234964 | amira3 | A | March 2, 2024, 3:25 a.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249241119 | S2auCe | A | March 2, 2024, 4:27 a.m. | OK | GNU C++20 (64) | TESTS | 6 | 0 | 0 | ||
249243082 | cyyyyyyyy | A | March 2, 2024, 4:45 a.m. | OK | Go | TESTS | 6 | 919 | 3276800 | ||
249249161 | Swi-ft | A | March 2, 2024, 5:34 a.m. | OK | Go | TESTS | 6 | 998 | 3276800 | ||
249214505 | mertyilmaz | A | March 1, 2024, 9:38 p.m. | OK | Haskell | TESTS | 6 | 46 | 0 | ||
249184259 | Festyve | A | March 1, 2024, 5:46 p.m. | OK | Java 21 | TESTS | 6 | 217 | 0 | ||
249248496 | Nick | A | March 2, 2024, 5:29 a.m. | OK | Java 21 | TESTS | 6 | 233 | 0 | ||
249182184 | Mudassir13631 | A | March 1, 2024, 5:34 p.m. | OK | Java 21 | TESTS | 6 | 233 | 0 | ||
249229269 | mapleKing | A | March 2, 2024, 2:14 a.m. | OK | Java 21 | TESTS | 6 | 233 | 204800 | ||
249222993 | Abood19 | A | March 2, 2024, 12:18 a.m. | OK | Java 21 | TESTS | 6 | 233 | 307200 | ||
249222971 | Abood19 | A | March 2, 2024, 12:17 a.m. | OK | Java 21 | TESTS | 6 | 249 | 102400 | ||
249188441 | yogesg_25 | A | March 1, 2024, 6:10 p.m. | OK | Java 21 | TESTS | 6 | 264 | 0 | ||
249245917 | Mohit_Jaiswal10 | A | March 2, 2024, 5:09 a.m. | OK | Java 21 | TESTS | 6 | 265 | 204800 | ||
249192798 | JAY.SHREE.RAM | A | March 1, 2024, 6:36 p.m. | OK | Java 21 | TESTS | 6 | 280 | 0 | ||
249184591 | himneesh9 | A | March 1, 2024, 5:48 p.m. | OK | Java 21 | TESTS | 6 | 280 | 0 | ||
249243484 | Mr.Numerator_007 | A | March 2, 2024, 4:49 a.m. | OK | Java 8 | TESTS | 6 | 78 | 0 | ||
249249942 | too_depressed | A | March 2, 2024, 5:40 a.m. | OK | Java 8 | TESTS | 6 | 93 | 0 | ||
249218165 | wat2 | A | March 1, 2024, 10:31 p.m. | OK | Java 8 | TESTS | 6 | 93 | 0 | ||
249181252 | Mudassir13631 | A | March 1, 2024, 5:30 p.m. | OK | Java 8 | TESTS | 6 | 108 | 0 | ||
249176192 | yash49 | A | March 1, 2024, 5:10 p.m. | OK | Java 8 | TESTS | 6 | 108 | 0 | ||
249250132 | ajay.code04 | A | March 2, 2024, 5:41 a.m. | OK | Java 8 | TESTS | 6 | 124 | 0 | ||
249240672 | AgniWarrior | A | March 2, 2024, 4:22 a.m. | OK | Java 8 | TESTS | 6 | 124 | 0 | ||
249197638 | samwise | A | March 1, 2024, 7:07 p.m. | OK | Java 8 | TESTS | 6 | 124 | 0 | ||
249182377 | Mudassir13631 | A | March 1, 2024, 5:35 p.m. | OK | Java 8 | TESTS | 6 | 124 | 0 | ||
249203491 | Indrajit | A | March 1, 2024, 7:51 p.m. | OK | Java 8 | TESTS | 6 | 124 | 6041600 | ||
249214540 | bio-duplex | A | March 1, 2024, 9:38 p.m. | OK | Kotlin 1.9 | TESTS | 6 | 155 | 0 | ||
249245220 | jiajunnb | A | March 2, 2024, 5:04 a.m. | OK | MS C++ 2017 | TESTS | 6 | 46 | 0 | ||
249171983 | Devansh_Dhookia | A | March 1, 2024, 4:34 p.m. | OK | MS C++ 2017 | TESTS | 6 | 46 | 0 | ||
249223131 | crapcode | A | March 2, 2024, 12:20 a.m. | OK | PHP | TESTS | 6 | 15 | 0 | ||
249252737 | hayagrivan.dj | A | March 2, 2024, 6 a.m. | OK | PyPy 3 | TESTS | 6 | 155 | 3072000 | ||
249185758 | _justSam_ | A | March 1, 2024, 5:54 p.m. | OK | PyPy 3 | TESTS | 6 | 155 | 3993600 | ||
249229761 | DrCoder9146 | A | March 2, 2024, 2:22 a.m. | OK | PyPy 3 | TESTS | 6 | 170 | 3788800 | ||
249230347 | TSUBAKII | A | March 2, 2024, 2:32 a.m. | OK | PyPy 3 | TESTS | 6 | 171 | 4505600 | ||
249180244 | yuktaxxx | A | March 1, 2024, 5:25 p.m. | OK | PyPy 3 | TESTS | 6 | 186 | 4300800 | ||
249170862 | arsh73552 | A | March 1, 2024, 4:33 p.m. | OK | PyPy 3 | TESTS | 6 | 218 | 2969600 | ||
249227842 | nealzane | A | March 2, 2024, 1:50 a.m. | OK | PyPy 3 | TESTS | 6 | 233 | 5120000 | ||
249246222 | Raindrops1117 | A | March 2, 2024, 5:11 a.m. | OK | PyPy 3 | TESTS | 6 | 234 | 6860800 | ||
249223255 | layzer | A | March 2, 2024, 12:23 a.m. | OK | PyPy 3-64 | TESTS | 6 | 61 | 1740800 | ||
249225229 | InHng | A | March 2, 2024, 12:59 a.m. | OK | PyPy 3-64 | TESTS | 6 | 61 | 1843200 | ||
249177711 | jvatsal0709 | A | March 1, 2024, 5:15 p.m. | OK | PyPy 3-64 | TESTS | 6 | 62 | 2252800 | ||
249184303 | el_tunel | A | March 1, 2024, 5:46 p.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 1740800 | ||
249191456 | bergus | A | March 1, 2024, 6:28 p.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 2048000 | ||
249182059 | bergus | A | March 1, 2024, 5:34 p.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 2048000 | ||
249231445 | Drought | A | March 2, 2024, 2:49 a.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 2457600 | ||
249219101 | voicon | A | March 1, 2024, 10:48 p.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 2560000 | ||
249178587 | gardengnome | A | March 1, 2024, 5:19 p.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 2560000 | ||
249188380 | RobinFromTheHood | A | March 1, 2024, 6:09 p.m. | OK | PyPy 3-64 | TESTS | 6 | 77 | 2662400 | ||
249176141 | OLOGY | A | March 1, 2024, 5:10 p.m. | OK | Python 2 | TESTS | 6 | 77 | 819200 | ||
249249243 | hackerofkz | A | March 2, 2024, 5:35 a.m. | OK | Python 3 | TESTS | 6 | 31 | 204800 | ||
249238187 | pssingh | A | March 2, 2024, 3:58 a.m. | OK | Python 3 | TESTS | 6 | 31 | 204800 | ||
249200307 | caio-felipee | A | March 1, 2024, 7:26 p.m. | OK | Python 3 | TESTS | 6 | 31 | 409600 | ||
249180961 | Freddy_Michael | A | March 1, 2024, 5:28 p.m. | OK | Python 3 | TESTS | 6 | 31 | 409600 | ||
249220938 | smugi | A | March 1, 2024, 11:28 p.m. | OK | Python 3 | TESTS | 6 | 31 | 512000 | ||
249185194 | AL_hadhrami | A | March 1, 2024, 5:51 p.m. | OK | Python 3 | TESTS | 6 | 31 | 512000 | ||
249210972 | MINASALAH555 | A | March 1, 2024, 8:58 p.m. | OK | Python 3 | TESTS | 6 | 46 | 102400 | ||
249196372 | ag5356 | A | March 1, 2024, 6:58 p.m. | OK | Python 3 | TESTS | 6 | 46 | 102400 | ||
249250735 | hushbek_2009 | A | March 2, 2024, 5:45 a.m. | OK | Python 3 | TESTS | 6 | 46 | 204800 | ||
249235796 | SriVarshiniAkula | A | March 2, 2024, 3:33 a.m. | OK | Python 3 | TESTS | 6 | 46 | 204800 | ||
249182690 | Hyrulia | A | March 1, 2024, 5:37 p.m. | OK | Rust 2021 | TESTS | 6 | 15 | 1024000 |
Back to search problems