Codeforces Round 831 (Div. 1 + 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
1740 Codeforces Round 831 (Div. 1 + Div. 2) FINISHED False 9900 70231762 Oct. 29, 2022, 9:10 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13878 ) B Jumbo Extra Cheese 2 PROGRAMMING geometry greedy sortings 800

B'Pak Chanek has n two-dimensional slices of cheese. The i -th slice of cheese can be represented as a rectangle of dimensions a_i x b_i . We want to arrange them on the two-dimensional plane such that: Note that we can arrange them in any order (the leftmost slice of cheese is not necessarily the first slice of cheese). Also note that we can rotate each slice of cheese in any way as long as all conditions still hold. Find the minimum possible perimeter of the constructed shape. Each test contains multiple test cases. The first line contains an integer t ( 1 <= q t <= q 2 cdot 10^4 ) -- the number of test cases. The following lines contain the description of each test case. The first line of each test case contains an integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the number of slices of cheese Pak Chanek has. The i -th of the next n lines of each test case contains two integers a_i and b_i ( 1 <= q a_i,b_i <= q 10^9 ) -- the dimensions of the i -th slice of cheese. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a line containing an integer representing the minimum possible perimeter of the constructed shape. In the first test case, a way of getting the minimum possible perimeter is to arrange the slices of cheese as follows. We can calculate that the perimeter of the constructed shape is 2+5+1+1+1+1+3+1+5+1+2+3=26 . It can be shown that we cannot get a smaller perimeter. Consider the following invalid arrangement. Even though the perimeter of the shape above is 24 , it does not satisfy all conditions of the problem. The bottom edge of the 1 x 1 slice of cheese is not a segment of the x-axis. In the second test case, a way of getting the minimum possible perimeter is to arrange the slices of cheese as follows. We can calculate that the perimeter of the constructed shape is 2+2+2+3+2+'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
178402903 mrgaolll B Oct. 29, 2022, 12:56 p.m. OK GNU C11 TESTS 16 93 0 800
178419915 yurui111 B Oct. 29, 2022, 3:09 p.m. OK GNU C11 TESTS 16 93 0 800
178398917 SP2003 B Oct. 29, 2022, 12:37 p.m. OK GNU C11 TESTS 16 93 1638400 800
178444227 Luthfiyyah_a B Oct. 29, 2022, 6:51 p.m. OK GNU C11 TESTS 16 109 0 800
178468626 Mushfiqur_ B Oct. 30, 2022, 4:21 a.m. OK GNU C11 TESTS 16 109 0 800
178462431 Ap0stoL B Oct. 30, 2022, 1:10 a.m. OK GNU C11 TESTS 16 109 0 800
178432337 SAFIN07 B Oct. 29, 2022, 4:53 p.m. OK GNU C11 TESTS 16 109 3174400 800
178402703 mrgaolll B Oct. 29, 2022, 12:55 p.m. OK GNU C11 TESTS 16 109 3174400 800
178423824 Kazi_Mahin_Mahfuz B Oct. 29, 2022, 3:45 p.m. OK GNU C11 TESTS 16 124 0 800
178431634 mskbs_038 B Oct. 29, 2022, 4:46 p.m. OK GNU C11 TESTS 16 186 3174400 800
178466718 Tom66 B Oct. 30, 2022, 3:31 a.m. OK GNU C++14 TESTS 16 46 5529600 800
178466522 Tom66 B Oct. 30, 2022, 3:27 a.m. OK GNU C++14 TESTS 16 62 5529600 800
178409602 18079602575 B Oct. 29, 2022, 1:46 p.m. OK GNU C++14 TESTS 16 93 0 800
178466749 luoZH111 B Oct. 30, 2022, 3:32 a.m. OK GNU C++14 TESTS 16 93 0 800
178468694 yipima2016 B Oct. 30, 2022, 4:23 a.m. OK GNU C++14 TESTS 16 93 0 800
178468868 zltzlt B Oct. 30, 2022, 4:27 a.m. OK GNU C++14 TESTS 16 93 0 800
178462564 LYT0122 B Oct. 30, 2022, 1:17 a.m. OK GNU C++14 TESTS 16 93 2457600 800
178403215 XfoxsX B Oct. 29, 2022, 12:58 p.m. OK GNU C++14 TESTS 16 93 3174400 800
178462639 RSLJ B Oct. 30, 2022, 1:19 a.m. OK GNU C++14 TESTS 16 108 1638400 800
178471175 AkaiLemon B Oct. 30, 2022, 5:12 a.m. OK GNU C++14 TESTS 16 109 0 800
178412696 peanutbutter1 B Oct. 29, 2022, 2:09 p.m. OK GNU C++17 TESTS 16 78 0 800
178464062 acwing_meow B Oct. 30, 2022, 2:12 a.m. OK GNU C++17 TESTS 16 93 0 800
178462925 julic20s B Oct. 30, 2022, 1:31 a.m. OK GNU C++17 TESTS 16 93 1638400 800
178465446 Beginner343 B Oct. 30, 2022, 2:54 a.m. OK GNU C++17 TESTS 16 108 2457600 800
178416108 doaaaaaa B Oct. 29, 2022, 2:36 p.m. OK GNU C++17 TESTS 16 109 0 800
178473150 BlankYang B Oct. 30, 2022, 5:41 a.m. OK GNU C++17 TESTS 16 109 0 800
178421388 microne_mzx B Oct. 29, 2022, 3:23 p.m. OK GNU C++17 TESTS 16 109 0 800
178389830 dickynovanto1103 B Oct. 29, 2022, 11:38 a.m. OK GNU C++17 TESTS 16 109 0 800
178422159 M-o-b-a-r-a-k B Oct. 29, 2022, 3:30 p.m. OK GNU C++17 TESTS 16 109 1638400 800
178463402 Obada-_- B Oct. 30, 2022, 1:49 a.m. OK GNU C++17 TESTS 16 109 1638400 800
178428078 iamarman252575 B Oct. 29, 2022, 4:23 p.m. OK GNU C++17 (64) TESTS 16 77 0 800
178424055 incursive B Oct. 29, 2022, 3:47 p.m. OK GNU C++17 (64) TESTS 16 77 0 800
178409211 _Alaa_ B Oct. 29, 2022, 1:43 p.m. OK GNU C++17 (64) TESTS 16 77 0 800
178399049 rohan_101 B Oct. 29, 2022, 12:37 p.m. OK GNU C++17 (64) TESTS 16 77 0 800
178398996 roadside_romio B Oct. 29, 2022, 12:37 p.m. OK GNU C++17 (64) TESTS 16 77 0 800
178399062 Sohaila_Elwaleed B Oct. 29, 2022, 12:37 p.m. OK GNU C++17 (64) TESTS 16 77 3174400 800
178466736 ChroneZU B Oct. 30, 2022, 3:32 a.m. OK GNU C++17 (64) TESTS 16 78 0 800
178444290 i_m_swachha B Oct. 29, 2022, 6:52 p.m. OK GNU C++17 (64) TESTS 16 78 0 800
178441637 urBCI B Oct. 29, 2022, 6:22 p.m. OK GNU C++17 (64) TESTS 16 78 0 800
178433637 hehe_boi30 B Oct. 29, 2022, 5:06 p.m. OK GNU C++17 (64) TESTS 16 78 0 800
178456106 _AhmedMohamed_ B Oct. 29, 2022, 9:35 p.m. OK GNU C++20 (64) TESTS 16 62 0 800
178472023 njwrz B Oct. 30, 2022, 5:24 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178471386 Ask3421 B Oct. 30, 2022, 5:15 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178470025 sasta_samurai B Oct. 30, 2022, 4:51 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178469854 royboylab B Oct. 30, 2022, 4:48 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178465133 Sun_flower_ B Oct. 30, 2022, 2:45 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178463118 Ahmed_Elhosiny B Oct. 30, 2022, 1:38 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178461476 ingingin B Oct. 30, 2022, 12:31 a.m. OK GNU C++20 (64) TESTS 16 62 0 800
178455683 Venti_chai B Oct. 29, 2022, 9:24 p.m. OK GNU C++20 (64) TESTS 16 62 0 800
178454284 Rakshit.X.Divinity B Oct. 29, 2022, 8:56 p.m. OK GNU C++20 (64) TESTS 16 62 0 800
178428116 mtarunsai1999 B Oct. 29, 2022, 4:24 p.m. OK Go TESTS 16 202 4710400 800
178470771 the_unseen B Oct. 30, 2022, 5:06 a.m. OK Java 11 TESTS 16 264 0 800
178433034 doomhammer. B Oct. 29, 2022, 5 p.m. OK Java 11 TESTS 16 264 0 800
178438666 sunaj B Oct. 29, 2022, 5:53 p.m. OK Java 11 TESTS 16 280 0 800
178436640 veerabhadra B Oct. 29, 2022, 5:34 p.m. OK Java 11 TESTS 16 280 0 800
178438311 bajpaisharanya B Oct. 29, 2022, 5:49 p.m. OK Java 11 TESTS 16 311 0 800
178420809 _milon_3.4 B Oct. 29, 2022, 3:18 p.m. OK Java 11 TESTS 16 343 0 800
178425535 princeayush04 B Oct. 29, 2022, 4:01 p.m. OK Java 11 TESTS 16 343 3891200 800
178420045 _milon_3.4 B Oct. 29, 2022, 3:11 p.m. OK Java 11 TESTS 16 436 12390400 800
178390738 dinanzhao B Oct. 29, 2022, 11:41 a.m. OK Java 11 TESTS 16 529 15052800 800
178466286 anshkaushik9454 B Oct. 30, 2022, 3:20 a.m. OK Java 11 TESTS 16 716 0 800
178389917 serndipty_ B Oct. 29, 2022, 11:38 a.m. OK Java 17 TESTS 16 327 3993600 800
178388880 ftng B Oct. 29, 2022, 11:35 a.m. OK Java 17 TESTS 16 343 204800 800
178410940 _Abeke_ B Oct. 29, 2022, 1:55 p.m. OK Java 17 TESTS 16 389 512000 800
178402728 hahahursh B Oct. 29, 2022, 12:55 p.m. OK Java 17 TESTS 16 389 819200 800
178441838 merlin_ B Oct. 29, 2022, 6:24 p.m. OK Java 17 TESTS 16 420 0 800
178422316 Ali04 B Oct. 29, 2022, 3:31 p.m. OK Java 17 TESTS 16 499 7372800 800
178456781 Kay0 B Oct. 29, 2022, 9:49 p.m. OK Java 17 TESTS 16 811 921600 800
178440930 zaghaltariq007 B Oct. 29, 2022, 6:15 p.m. OK Java 17 TESTS 16 842 716800 800
178407980 Terzou B Oct. 29, 2022, 1:34 p.m. OK Java 17 TESTS 16 842 1126400 800
178426310 priyaroy3370 B Oct. 29, 2022, 4:07 p.m. OK Java 17 TESTS 16 857 819200 800
178446335 Diaa12360 B Oct. 29, 2022, 7:17 p.m. OK Java 8 TESTS 16 109 0 800
178423711 Rayhan_07 B Oct. 29, 2022, 3:44 p.m. OK Java 8 TESTS 16 109 0 800
178414697 tfq__ B Oct. 29, 2022, 2:24 p.m. OK Java 8 TESTS 16 124 0 800
178437862 RahulAhuja2901 B Oct. 29, 2022, 5:45 p.m. OK Java 8 TESTS 16 140 0 800
178459077 ahmedtawfik B Oct. 29, 2022, 10:55 p.m. OK Java 8 TESTS 16 171 0 800
178446495 mohamedhassan_c B Oct. 29, 2022, 7:19 p.m. OK Java 8 TESTS 16 187 0 800
178439962 wadissimo B Oct. 29, 2022, 6:06 p.m. OK Java 8 TESTS 16 187 0 800
178409967 Dark_Knight_07 B Oct. 29, 2022, 1:49 p.m. OK Java 8 TESTS 16 187 0 800
178467776 youtsuha B Oct. 30, 2022, 3:58 a.m. OK Java 8 TESTS 16 202 0 800
178410477 Otepbergen B Oct. 29, 2022, 1:52 p.m. OK Java 8 TESTS 16 217 12390400 800
178417411 Gompu123 B Oct. 29, 2022, 2:47 p.m. OK Kotlin 1.5 TESTS 16 499 27852800 800
178400513 Autlomu B Oct. 29, 2022, 12:41 p.m. OK MS C++ 2017 TESTS 16 109 4812800 800
178391840 Tory_A B Oct. 29, 2022, 11:45 a.m. OK MS C++ 2017 TESTS 16 389 1638400 800
178465223 Yaokasl B Oct. 30, 2022, 2:47 a.m. OK MS C++ 2017 TESTS 16 390 0 800
178437396 abdulkader_haffar B Oct. 29, 2022, 5:41 p.m. OK MS C++ 2017 TESTS 16 390 0 800
178428766 Kratreus B Oct. 29, 2022, 4:29 p.m. OK MS C++ 2017 TESTS 16 405 0 800
178466269 mu_wen B Oct. 30, 2022, 3:19 a.m. OK MS C++ 2017 TESTS 16 421 1638400 800
178431403 Anonymous_chief B Oct. 29, 2022, 4:44 p.m. OK MS C++ 2017 TESTS 16 421 1638400 800
178393350 Vlasov211 B Oct. 29, 2022, 11:49 a.m. OK MS C++ 2017 TESTS 16 421 3174400 800
178462133 Alex0304 B Oct. 30, 2022, 12:59 a.m. OK MS C++ 2017 TESTS 16 436 0 800
178392228 belief_010 B Oct. 29, 2022, 11:47 a.m. OK MS C++ 2017 TESTS 16 452 5632000 800
178422650 sameer_ihs03 B Oct. 29, 2022, 3:34 p.m. OK PyPy 3 TESTS 16 248 9011200 800
178427521 mohfasalih B Oct. 29, 2022, 4:18 p.m. OK PyPy 3 TESTS 16 514 10649600 800
178406722 aneesh2002 B Oct. 29, 2022, 1:25 p.m. OK PyPy 3 TESTS 16 592 26624000 800
178404071 auvred B Oct. 29, 2022, 1:04 p.m. OK PyPy 3 TESTS 16 842 23859200 800
178458488 yfo B Oct. 29, 2022, 10:35 p.m. OK PyPy 3 TESTS 16 997 11468800 800
178416441 omar.gawdat B Oct. 29, 2022, 2:39 p.m. OK PyPy 3-64 TESTS 16 124 7680000 800
178414593 pizet B Oct. 29, 2022, 2:23 p.m. OK PyPy 3-64 TESTS 16 124 11673600 800
178432111 mohammadolimat B Oct. 29, 2022, 4:51 p.m. OK PyPy 3-64 TESTS 16 139 8806400 800
178441061 JamesHu B Oct. 29, 2022, 6:16 p.m. OK PyPy 3-64 TESTS 16 139 12083200 800
178387746 kevin1211 B Oct. 29, 2022, 11:33 a.m. OK PyPy 3-64 TESTS 16 140 8908800 800
178391649 DTUPIS B Oct. 29, 2022, 11:45 a.m. OK PyPy 3-64 TESTS 16 155 8806400 800
178410730 hitthheerree B Oct. 29, 2022, 1:54 p.m. OK PyPy 3-64 TESTS 16 155 9113600 800
178404765 biglunchdude B Oct. 29, 2022, 1:09 p.m. OK PyPy 3-64 TESTS 16 155 14131200 800
178401183 crapcode B Oct. 29, 2022, 12:45 p.m. OK PyPy 3-64 TESTS 16 156 8908800 800
178441913 govindp47 B Oct. 29, 2022, 6:25 p.m. OK PyPy 3-64 TESTS 16 171 8908800 800
178412691 pizet B Oct. 29, 2022, 2:08 p.m. OK Python 3 TESTS 16 499 0 800
178413130 fa_than B Oct. 29, 2022, 2:12 p.m. OK Python 3 TESTS 16 499 13414400 800
178414523 pizet B Oct. 29, 2022, 2:23 p.m. OK Python 3 TESTS 16 514 9113600 800
178429238 Savelij B Oct. 29, 2022, 4:34 p.m. OK Python 3 TESTS 16 529 0 800
178457812 alaa81313 B Oct. 29, 2022, 10:15 p.m. OK Python 3 TESTS 16 545 0 800
178410336 bhaumik754 B Oct. 29, 2022, 1:51 p.m. OK Python 3 TESTS 16 545 0 800
178402005 SilverGodly B Oct. 29, 2022, 12:50 p.m. OK Python 3 TESTS 16 545 0 800
178447073 arihant72600 B Oct. 29, 2022, 7:27 p.m. OK Python 3 TESTS 16 546 0 800
178423871 20cs3045 B Oct. 29, 2022, 3:45 p.m. OK Python 3 TESTS 16 560 9830400 800
178420043 borui1 B Oct. 29, 2022, 3:11 p.m. OK Python 3 TESTS 16 561 0 800
178431343 controllerOfWorlds B Oct. 29, 2022, 4:43 p.m. OK Rust 2021 TESTS 16 139 4198400 800
178420489 jcowgill B Oct. 29, 2022, 3:15 p.m. OK Rust 2021 TESTS 16 155 0 800
178401494 dohyeokkim B Oct. 29, 2022, 12:47 p.m. OK Rust 2021 TESTS 16 218 0 800

remove filters

Back to search problems