Educational Codeforces Round 157 (Rated for Div. 2)

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
1895 Educational Codeforces Round 157 (Rated for Div. 2) FINISHED False 7200 38157863 Nov. 3, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 20663 ) B Points and Minimum Distance PROGRAMMING greedy math sortings

B'You are given a sequence of integers a of length 2n . You have to split these 2n integers into n pairs; each pair will represent the coordinates of a point on a plane. Each number from the sequence a should become the x or y coordinate of exactly one point. Note that some points can be equal. After the points are formed, you have to choose a path s that starts from one of these points, ends at one of these points, and visits all n points at least once. The length of path s is the sum of distances between all adjacent points on the path. In this problem, the distance between two points (x_1, y_1) and (x_2, y_2) is defined as |x_1-x_2| + |y_1-y_2| . Your task is to form n points and choose a path s in such a way that the length of path s is minimized. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of testcases. The first line of each testcase contains a single integer n ( 2 <= n <= 100 ) -- the number of points to be formed. The next line contains 2n integers a_1, a_2, ... , a_{2n} ( 0 <= a_i <= 1 ,000 ) -- the description of the sequence a . For each testcase, print the minimum possible length of path s in the first line. In the i -th of the following n lines, print two integers x_i and y_i -- the coordinates of the point that needs to be visited at the i -th position. If there are multiple answers, print any of them. In the first testcase, for instance, you can form points (10, 1) and (15, 5) and start the path s from the first point and end it at the second point. Then the length of the path will be |10 - 15| + |1 - 5| = 5 + 4 = 9 . In the second testcase, you can form points (20, 20) , (10, 30) , and (10, 30) , and visit them in that exact order. Then the length of the path will be |20 - 10| + |20 - 30| + |'...

Tutorials

Educational Codeforces Round 157 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
231209364 Masud-Parvez B Nov. 3, 2023, 4:52 p.m. OK C# 10 TESTS 2 62 1843200
231206692 Masud-Parvez B Nov. 3, 2023, 4:38 p.m. OK C# 10 TESTS 2 62 2150400
231214073 kokora B Nov. 3, 2023, 5:21 p.m. OK C# 10 TESTS 2 62 2457600
231277451 sh_arman B Nov. 4, 2023, 5 a.m. OK C# 10 TESTS 2 77 1638400
231253241 bluemegane B Nov. 3, 2023, 10:23 p.m. OK C# 8 TESTS 2 77 1331200
231207170 ChiyoYuki_if B Nov. 3, 2023, 4:40 p.m. OK Clang++20 Diagnostics TESTS 2 30 0
231249044 mohammed232003 B Nov. 3, 2023, 9:14 p.m. OK Clang++20 Diagnostics TESTS 2 170 0
231197638 lazylettuce B Nov. 3, 2023, 4:20 p.m. OK GNU C11 TESTS 2 31 0
231201794 devanshsoni990 B Nov. 3, 2023, 4:28 p.m. OK GNU C11 TESTS 2 46 0
231235998 stanzzz B Nov. 3, 2023, 7:22 p.m. OK GNU C11 TESTS 2 46 0
231267504 Ashwaghosh_ai B Nov. 4, 2023, 2:44 a.m. OK GNU C11 TESTS 2 46 0
231204340 verywater B Nov. 3, 2023, 4:33 p.m. OK GNU C11 TESTS 2 46 0
231206455 ABR_2005 B Nov. 3, 2023, 4:37 p.m. OK GNU C11 TESTS 2 46 0
231208903 Unk1ndled B Nov. 3, 2023, 4:49 p.m. OK GNU C11 TESTS 2 46 0
231208978 Unk1ndled B Nov. 3, 2023, 4:49 p.m. OK GNU C11 TESTS 2 46 0
231217187 sidOP21 B Nov. 3, 2023, 5:42 p.m. OK GNU C11 TESTS 2 46 0
231219887 joyoshreesaha B Nov. 3, 2023, 6:02 p.m. OK GNU C11 TESTS 2 46 0
231276392 luogu_bot5 B Nov. 4, 2023, 4:45 a.m. OK GNU C++14 TESTS 2 0 0
231271011 Ravindra45 B Nov. 4, 2023, 3:28 a.m. OK GNU C++14 TESTS 2 0 0
231266971 chenningxuan88 B Nov. 4, 2023, 2:37 a.m. OK GNU C++14 TESTS 2 0 0
231266705 Chen_Jinhui B Nov. 4, 2023, 2:33 a.m. OK GNU C++14 TESTS 2 0 0
231261587 bkifhr8 B Nov. 4, 2023, 1:21 a.m. OK GNU C++14 TESTS 2 0 0
231261469 _fengxiaoyi B Nov. 4, 2023, 1:20 a.m. OK GNU C++14 TESTS 2 0 0
231260539 qzhwlzy B Nov. 4, 2023, 1:07 a.m. OK GNU C++14 TESTS 2 0 0
231259130 chenningxuan88 B Nov. 4, 2023, 12:40 a.m. OK GNU C++14 TESTS 2 0 0
231280843 utkarsh_b B Nov. 4, 2023, 5:41 a.m. OK GNU C++14 TESTS 2 0 0
231276406 akkipoonia B Nov. 4, 2023, 4:46 a.m. OK GNU C++14 TESTS 2 0 0
231274193 mehrab1513769 B Nov. 4, 2023, 4:13 a.m. OK GNU C++17 TESTS 2 0 0
231277170 710567 B Nov. 4, 2023, 4:56 a.m. OK GNU C++17 TESTS 2 0 0
231277830 Ayanak2004 B Nov. 4, 2023, 5:05 a.m. OK GNU C++17 TESTS 2 0 0
231277881 dhruv2000 B Nov. 4, 2023, 5:05 a.m. OK GNU C++17 TESTS 2 0 0
231279379 abhirup76 B Nov. 4, 2023, 5:25 a.m. OK GNU C++17 TESTS 2 0 0
231280568 MrLinYin B Nov. 4, 2023, 5:38 a.m. OK GNU C++17 TESTS 2 0 0
231282701 ebrahim_77 B Nov. 4, 2023, 5:58 a.m. OK GNU C++17 TESTS 2 0 0
231280842 likhnic B Nov. 4, 2023, 5:41 a.m. OK GNU C++17 TESTS 2 0 0
231266102 uday03meh B Nov. 4, 2023, 2:25 a.m. OK GNU C++17 TESTS 2 0 0
231254829 lgmhunters B Nov. 3, 2023, 10:58 p.m. OK GNU C++17 TESTS 2 0 0
231209870 Once_I_Liked_AGirl B Nov. 3, 2023, 4:55 p.m. OK GNU C++17 (64) TESTS 2 0 0
231275287 yyxc_nasd B Nov. 4, 2023, 4:30 a.m. OK GNU C++17 (64) TESTS 2 0 0
231272381 4Ace B Nov. 4, 2023, 3:47 a.m. OK GNU C++17 (64) TESTS 2 0 0
231267253 Dudak B Nov. 4, 2023, 2:41 a.m. OK GNU C++17 (64) TESTS 2 0 0
231256148 Teranj B Nov. 3, 2023, 11:29 p.m. OK GNU C++17 (64) TESTS 2 0 0
231251807 enslaved B Nov. 3, 2023, 9:56 p.m. OK GNU C++17 (64) TESTS 2 0 0
231244146 Rashed.23 B Nov. 3, 2023, 8:20 p.m. OK GNU C++17 (64) TESTS 2 0 0
231212798 __Sunny__ B Nov. 3, 2023, 5:12 p.m. OK GNU C++17 (64) TESTS 2 0 0
231209408 __HiM_001 B Nov. 3, 2023, 4:52 p.m. OK GNU C++17 (64) TESTS 2 0 0
231198668 CHVK_Wagner B Nov. 3, 2023, 4:22 p.m. OK GNU C++17 (64) TESTS 2 0 0
231275991 65_67_77 B Nov. 4, 2023, 4:40 a.m. OK GNU C++20 (64) TESTS 2 0 0
231276136 CaptainBD B Nov. 4, 2023, 4:42 a.m. OK GNU C++20 (64) TESTS 2 0 0
231276250 void_3 B Nov. 4, 2023, 4:43 a.m. OK GNU C++20 (64) TESTS 2 0 0
231276252 Nurkhat-OskBIL-26 B Nov. 4, 2023, 4:43 a.m. OK GNU C++20 (64) TESTS 2 0 0
231276946 Divyam64 B Nov. 4, 2023, 4:53 a.m. OK GNU C++20 (64) TESTS 2 0 0
231279232 chopade.sahil02 B Nov. 4, 2023, 5:23 a.m. OK GNU C++20 (64) TESTS 2 0 0
231279717 _Tiger B Nov. 4, 2023, 5:28 a.m. OK GNU C++20 (64) TESTS 2 0 0
231281126 tangjing B Nov. 4, 2023, 5:43 a.m. OK GNU C++20 (64) TESTS 2 0 0
231281754 Milan_Nakum B Nov. 4, 2023, 5:49 a.m. OK GNU C++20 (64) TESTS 2 0 0
231282667 arsalan_cse786 B Nov. 4, 2023, 5:57 a.m. OK GNU C++20 (64) TESTS 2 0 0
231274665 True_Romantic B Nov. 4, 2023, 4:20 a.m. OK Go TESTS 2 15 307200
231222344 Atlasmoth B Nov. 3, 2023, 6:13 p.m. OK Haskell TESTS 2 77 0
231280562 foolcoder B Nov. 4, 2023, 5:38 a.m. OK Java 11 TESTS 2 171 0
231254882 Zakaria_Eysa B Nov. 3, 2023, 10:59 p.m. OK Java 11 TESTS 2 248 0
231248629 Bhuvan_sai B Nov. 3, 2023, 9:07 p.m. OK Java 11 TESTS 2 280 307200
231202107 adi218r1a0502 B Nov. 3, 2023, 4:29 p.m. OK Java 11 TESTS 2 280 307200
231235599 ceruly B Nov. 3, 2023, 7:20 p.m. OK Java 11 TESTS 2 295 307200
231196021 girisarthak B Nov. 3, 2023, 4:16 p.m. OK Java 11 TESTS 2 296 409600
231208477 arush.pettem B Nov. 3, 2023, 4:47 p.m. OK Java 11 TESTS 2 311 307200
231199264 DessertRommet B Nov. 3, 2023, 4:23 p.m. OK Java 11 TESTS 2 311 512000
231224835 xiaoyue B Nov. 3, 2023, 6:24 p.m. OK Java 11 TESTS 2 342 307200
231199185 _not_found B Nov. 3, 2023, 4:23 p.m. OK Java 11 TESTS 2 358 409600
231256195 Xing_ke B Nov. 3, 2023, 11:30 p.m. OK Java 17 TESTS 2 155 0
231211193 Nagendravarma B Nov. 3, 2023, 5:02 p.m. OK Java 17 TESTS 2 155 409600
231216639 dineshchandran311 B Nov. 3, 2023, 5:38 p.m. OK Java 17 TESTS 2 186 0
231247477 Harwinvanak B Nov. 3, 2023, 8:53 p.m. OK Java 17 TESTS 2 187 614400
231222490 Atlas B Nov. 3, 2023, 6:13 p.m. OK Java 17 TESTS 2 187 1331200
231275276 k.SUMANTH B Nov. 4, 2023, 4:30 a.m. OK Java 17 TESTS 2 233 1228800
231282101 sohamt-21 B Nov. 4, 2023, 5:52 a.m. OK Java 17 TESTS 2 233 1331200
231240514 dawn_raja B Nov. 3, 2023, 7:50 p.m. OK Java 17 TESTS 2 264 1126400
231199250 harshhtiwari B Nov. 3, 2023, 4:23 p.m. OK Java 17 TESTS 2 280 1024000
231236812 fooaem B Nov. 3, 2023, 7:27 p.m. OK Java 17 TESTS 2 295 716800
231260723 Ligh0x74 B Nov. 4, 2023, 1:09 a.m. OK Java 21 TESTS 2 202 409600
231276759 jasminell B Nov. 4, 2023, 4:51 a.m. OK Java 21 TESTS 2 280 307200
231205718 priyanshv10 B Nov. 3, 2023, 4:34 p.m. OK Java 21 TESTS 2 295 512000
231223757 akashmasadi B Nov. 3, 2023, 6:19 p.m. OK Java 21 TESTS 2 296 1228800
231199469 Abdubosit B Nov. 3, 2023, 4:24 p.m. OK Java 21 TESTS 2 296 1433600
231209130 priyanshv10 B Nov. 3, 2023, 4:50 p.m. OK Java 21 TESTS 2 342 1126400
231216740 RatanK B Nov. 3, 2023, 5:39 p.m. OK Java 21 TESTS 2 342 1228800
231208075 Souragni_2004 B Nov. 3, 2023, 4:45 p.m. OK Java 21 TESTS 2 358 512000
231204921 Souragni_2004 B Nov. 3, 2023, 4:34 p.m. OK Java 21 TESTS 2 358 921600
231207382 ADiTYa1914 B Nov. 3, 2023, 4:41 p.m. OK Java 21 TESTS 2 374 819200
231281598 devesh434 B Nov. 4, 2023, 5:48 a.m. OK Java 8 TESTS 2 140 0
231256597 yadavDipesh B Nov. 3, 2023, 11:39 p.m. OK Java 8 TESTS 2 155 0
231227039 Sumitsingh7 B Nov. 3, 2023, 6:34 p.m. OK Java 8 TESTS 2 155 6656000
231218558 momenoo B Nov. 3, 2023, 5:52 p.m. OK Java 8 TESTS 2 186 0
231229220 vickythelonelinux B Nov. 3, 2023, 6:45 p.m. OK Java 8 TESTS 2 187 0
231215391 ags613 B Nov. 3, 2023, 5:29 p.m. OK Java 8 TESTS 2 187 0
231214146 Steffi B Nov. 3, 2023, 5:21 p.m. OK Java 8 TESTS 2 202 0
231197084 just_a_niu_ma B Nov. 3, 2023, 4:19 p.m. OK Java 8 TESTS 2 202 0
231196972 ChitupoluSathvika B Nov. 3, 2023, 4:18 p.m. OK Java 8 TESTS 2 202 0
231272030 chengzijun_de_xiatian B Nov. 4, 2023, 3:42 a.m. OK Java 8 TESTS 2 218 0
231272933 DK_Arya B Nov. 4, 2023, 3:56 a.m. OK Kotlin 1.7 TESTS 2 561 31129600
231236909 samarthcode1 B Nov. 3, 2023, 7:28 p.m. OK MS C++ 2017 TESTS 2 31 0
231274102 catcher1 B Nov. 4, 2023, 4:12 a.m. OK MS C++ 2017 TESTS 2 46 0
231207585 ade_stop B Nov. 3, 2023, 4:42 p.m. OK MS C++ 2017 TESTS 2 46 0
231202243 Yashmalsai B Nov. 3, 2023, 4:29 p.m. OK MS C++ 2017 TESTS 2 46 0
231200296 Rishabh1210 B Nov. 3, 2023, 4:25 p.m. OK MS C++ 2017 TESTS 2 46 0
231202915 Priyanshume18 B Nov. 3, 2023, 4:30 p.m. OK MS C++ 2017 TESTS 2 61 0
231201065 rishabhpatel121003 B Nov. 3, 2023, 4:27 p.m. OK MS C++ 2017 TESTS 2 61 0
231196438 rohiththirunagari B Nov. 3, 2023, 4:17 p.m. OK MS C++ 2017 TESTS 2 61 0
231196221 CC_dsm B Nov. 3, 2023, 4:17 p.m. OK MS C++ 2017 TESTS 2 61 0
231199885 227r1a6633 B Nov. 3, 2023, 4:24 p.m. OK MS C++ 2017 TESTS 2 62 0
231280983 Samyak_15 B Nov. 4, 2023, 5:42 a.m. OK PyPy 3 TESTS 2 93 2457600
231269096 deveshbedmutha B Nov. 4, 2023, 3:05 a.m. OK PyPy 3 TESTS 2 109 4096000
231229189 jvatsal0709 B Nov. 3, 2023, 6:45 p.m. OK PyPy 3 TESTS 2 109 4198400
231217474 AFK068 B Nov. 3, 2023, 5:44 p.m. OK PyPy 3 TESTS 2 124 4300800
231281116 s010456 B Nov. 4, 2023, 5:43 a.m. OK PyPy 3 TESTS 2 139 3481600
231277158 MShah2003 B Nov. 4, 2023, 4:56 a.m. OK PyPy 3 TESTS 2 139 3993600
231274416 letamquang220805 B Nov. 4, 2023, 4:17 a.m. OK PyPy 3 TESTS 2 140 3481600
231201420 gauthamraj2401 B Nov. 3, 2023, 4:28 p.m. OK PyPy 3 TESTS 2 155 3481600
231238392 rmr B Nov. 3, 2023, 7:37 p.m. OK PyPy 3-64 TESTS 2 46 1945600
231228195 karnyadav B Nov. 3, 2023, 6:39 p.m. OK PyPy 3-64 TESTS 2 46 2457600
231204774 misoversit B Nov. 3, 2023, 4:33 p.m. OK PyPy 3-64 TESTS 2 61 2764800
231237994 rmr B Nov. 3, 2023, 7:34 p.m. OK PyPy 3-64 TESTS 2 62 2150400
231196504 oussamah4boubi B Nov. 3, 2023, 4:17 p.m. OK PyPy 3-64 TESTS 2 77 2150400
231272528 booskako B Nov. 4, 2023, 3:50 a.m. OK PyPy 3-64 TESTS 2 77 4505600
231226172 kinglykang B Nov. 3, 2023, 6:30 p.m. OK PyPy 3-64 TESTS 2 77 5836800
231251608 cybsbbb B Nov. 3, 2023, 9:53 p.m. OK PyPy 3-64 TESTS 2 77 6041600
231265669 MdAbedin B Nov. 4, 2023, 2:19 a.m. OK PyPy 3-64 TESTS 2 77 6348800
231274254 harrylfoppa B Nov. 4, 2023, 4:14 a.m. OK PyPy 3-64 TESTS 2 77 6860800
231221136 Ratery B Nov. 3, 2023, 6:07 p.m. OK Python 3 TESTS 2 15 0
231267756 khushigupta515 B Nov. 4, 2023, 2:48 a.m. OK Python 3 TESTS 2 30 307200
231228424 karnyadav B Nov. 3, 2023, 6:41 p.m. OK Python 3 TESTS 2 30 307200
231245290 andreeey B Nov. 3, 2023, 8:30 p.m. OK Python 3 TESTS 2 46 0
231200393 coderbd B Nov. 3, 2023, 4:26 p.m. OK Python 3 TESTS 2 46 0
231198768 Shantanu29 B Nov. 3, 2023, 4:22 p.m. OK Python 3 TESTS 2 46 0
231272985 Livfo B Nov. 4, 2023, 3:56 a.m. OK Python 3 TESTS 2 46 102400
231215174 udithdoddapaneni B Nov. 3, 2023, 5:28 p.m. OK Python 3 TESTS 2 46 102400
231210651 zmauricv B Nov. 3, 2023, 4:59 p.m. OK Python 3 TESTS 2 46 102400
231206492 shivanshkr2023 B Nov. 3, 2023, 4:38 p.m. OK Python 3 TESTS 2 46 102400
231249668 0npata B Nov. 3, 2023, 9:22 p.m. OK Rust 2021 TESTS 2 0 307200

remove filters

Back to search problems