Codeforces Round 866 (Div. 1)

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
1819 Codeforces Round 866 (Div. 1) FINISHED False 7200 50273699 April 15, 2023, 9:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3627 ) B The Butcher PROGRAMMING greedy implementation sortings two pointers

B'Anton plays his favorite game "Defense of The Ancients 2" for his favorite hero -- The Butcher. Now he wants to make his own dinner. To do this he will take a rectangle of height h and width w , then make a vertical or horizontal cut so that both resulting parts have integer sides. After that, he will put one of the parts in the box and cut the other again, and so on. More formally, a rectangle of size h x w can be cut into two parts of sizes x x w and (h - x) x w , where x is an integer from 1 to (h - 1) , or into two parts of sizes h x y and h x (w - y) , where y is an integer from 1 to (w - 1) . He will repeat this operation n - 1 times, and then put the remaining rectangle into the box too. Thus, the box will contain n rectangles, of which n - 1 rectangles were put in the box as a result of the cuts, and the n -th rectangle is the one that the Butcher has left after all n - 1 cuts. Unfortunately, Butcher forgot the numbers h and w , but he still has n rectangles mixed in random order. Note that Butcher didn 't rotate the rectangles, but only shuffled them. Now he wants to know all possible pairs (h, w) from which this set of rectangles can be obtained. And you have to help him do it! It is guaranteed that there exists at least one pair (h, w) from which this set of rectangles can be obtained. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of rectangles obtained. The i -th of the next n lines contains two integers a_i and b_i ( 1 <= a_i, b_i <= 10^6 ) -- the height and width of the i -th rectangle. It is guarante'...

Tutorials

Codeforces Round #866 (Div.1, Div.2, based on Lipetsk Team Olympiad) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
202194735 mban259 B April 15, 2023, 9:38 a.m. OK C# 10 TESTS 18 186 7372800
202207124 DmitriyAnikeyev B April 15, 2023, 10:05 a.m. OK C# 10 TESTS 18 342 41779200
202220129 kakel_san B April 15, 2023, 10:39 a.m. OK C# 8 TESTS 18 904 50688000
202188776 hos.lyric B April 15, 2023, 9:26 a.m. OK D TESTS 18 358 13516800
202201837 Gassa B April 15, 2023, 9:54 a.m. OK D TESTS 18 1107 56832000
202207780 chro4896 B April 15, 2023, 10:07 a.m. OK GNU C11 TESTS 18 202 5632000
202215056 Pompeii B April 15, 2023, 10:26 a.m. OK GNU C++14 TESTS 18 46 6041600
202195341 jason_sun B April 15, 2023, 9:40 a.m. OK GNU C++14 TESTS 18 109 3379200
202198475 Jormungandre B April 15, 2023, 9:46 a.m. OK GNU C++14 TESTS 18 109 9625600
202213862 likely B April 15, 2023, 10:22 a.m. OK GNU C++14 TESTS 18 124 20070400
202189379 Alex_Wei B April 15, 2023, 9:28 a.m. OK GNU C++14 TESTS 18 140 32768000
202202928 jiaosiyuan B April 15, 2023, 9:56 a.m. OK GNU C++14 TESTS 18 140 38195200
202206135 ru1_er B April 15, 2023, 10:03 a.m. OK GNU C++14 TESTS 18 140 42700800
202206932 Rita_Ross B April 15, 2023, 10:05 a.m. OK GNU C++14 TESTS 18 155 33280000
202222389 ekatsim B April 15, 2023, 10:46 a.m. OK GNU C++14 TESTS 18 155 48025600
202195604 AlternatingCurrent B April 15, 2023, 9:40 a.m. OK GNU C++14 TESTS 18 171 5017600
202192401 Oler_kzc B April 15, 2023, 9:34 a.m. OK GNU C++17 TESTS 18 78 3379200
202221587 lddlinan B April 15, 2023, 10:44 a.m. OK GNU C++17 TESTS 18 93 5017600
202327436 Hritik12 B April 16, 2023, 5:40 a.m. OK GNU C++17 TESTS 21 124 3276800
202250401 serotonin B April 15, 2023, 1:53 p.m. OK GNU C++17 TESTS 19 124 3379200
202194843 frodakcin B April 15, 2023, 9:39 a.m. OK GNU C++17 TESTS 18 124 3686400
202193762 pineapple_tree_34 B April 15, 2023, 9:36 a.m. OK GNU C++17 TESTS 18 124 5017600
202207166 sd0061 B April 15, 2023, 10:05 a.m. OK GNU C++17 TESTS 18 139 1638400
202201086 clonemasteruwu B April 15, 2023, 9:52 a.m. OK GNU C++17 TESTS 18 139 3993600
202203938 Barbatos B April 15, 2023, 9:58 a.m. OK GNU C++17 TESTS 18 139 3993600
202250303 serotonin B April 15, 2023, 1:52 p.m. OK GNU C++17 TESTS 19 139 25702400
202202997 Unique_Hanpi B April 15, 2023, 9:56 a.m. OK GNU C++17 (64) TESTS 18 46 5529600
202217368 MAOooOAM B April 15, 2023, 10:32 a.m. OK GNU C++17 (64) TESTS 18 93 5017600
202224903 stevenkplus B April 15, 2023, 10:53 a.m. OK GNU C++17 (64) TESTS 18 93 8396800
202212217 trieboi B April 15, 2023, 10:18 a.m. OK GNU C++17 (64) TESTS 18 109 5017600
202207534 4ever_in_queue B April 15, 2023, 10:06 a.m. OK GNU C++17 (64) TESTS 18 109 8499200
202208718 Superposition B April 15, 2023, 10:10 a.m. OK GNU C++17 (64) TESTS 18 109 12902400
202227081 gqf123 B April 15, 2023, 10:59 a.m. OK GNU C++17 (64) TESTS 18 124 5017600
202204555 Kude B April 15, 2023, 9:59 a.m. OK GNU C++17 (64) TESTS 18 124 7065600
202236993 YocyCraft B April 15, 2023, 12:08 p.m. OK GNU C++17 (64) TESTS 18 139 5632000
202196841 wsyear B April 15, 2023, 9:43 a.m. OK GNU C++17 (64) TESTS 18 139 11980800
202266518 2018LZY B April 15, 2023, 4:15 p.m. OK GNU C++20 (64) TESTS 19 46 4403200
202266670 2018LZY B April 15, 2023, 4:17 p.m. OK GNU C++20 (64) TESTS 19 46 4403200
202206269 jiangbowen B April 15, 2023, 10:03 a.m. OK GNU C++20 (64) TESTS 18 46 42086400
202185985 lmlmlm B April 15, 2023, 9:21 a.m. OK GNU C++20 (64) TESTS 18 62 3174400
202192390 TJ_Andeviking B April 15, 2023, 9:34 a.m. OK GNU C++20 (64) TESTS 18 62 4300800
202206096 Tx_Lcy B April 15, 2023, 10:03 a.m. OK GNU C++20 (64) TESTS 18 78 3174400
202326801 tatavayapmabulldogvd B April 16, 2023, 5:31 a.m. OK GNU C++20 (64) TESTS 21 78 3276800
202208991 Awesome3.14 B April 15, 2023, 10:11 a.m. OK GNU C++20 (64) TESTS 18 78 4812800
202246702 momoyao B April 15, 2023, 1:24 p.m. OK GNU C++20 (64) TESTS 19 78 6451200
202187157 ksun48 B April 15, 2023, 9:23 a.m. OK GNU C++20 (64) TESTS 18 78 6451200
202223682 profchi B April 15, 2023, 10:49 a.m. OK Java 11 TESTS 18 748 37990400
202246962 yvbf B April 15, 2023, 1:26 p.m. OK Java 8 TESTS 19 389 19251200
202285596 Aabhas99 B April 15, 2023, 7:04 p.m. OK Java 8 TESTS 19 561 47616000
202302928 IanISam B April 15, 2023, 9:58 p.m. OK Java 8 TESTS 19 873 42905600
202205002 elizarov B April 15, 2023, 10 a.m. OK Kotlin 1.7 TESTS 18 1466 144281600
202260385 Maruzensky B April 15, 2023, 3:17 p.m. OK PyPy 3-64 TESTS 19 389 35635200
202253438 blue_ice_yj B April 15, 2023, 2:16 p.m. OK PyPy 3-64 TESTS 19 530 33587200
202254629 blue_ice_yj B April 15, 2023, 2:27 p.m. OK PyPy 3-64 TESTS 19 592 43417600
202253727 blue_ice_yj B April 15, 2023, 2:18 p.m. OK PyPy 3-64 TESTS 19 654 33075200
202277577 Boomyday12343 B April 15, 2023, 6:10 p.m. OK PyPy 3-64 TESTS 19 1075 64409600
202206944 toam B April 15, 2023, 10:05 a.m. OK PyPy 3-64 TESTS 18 1341 95334400
202277194 Boomyday12343 B April 15, 2023, 6:06 p.m. OK PyPy 3-64 TESTS 19 1949 71270400
202215320 Unwise B April 15, 2023, 10:26 a.m. OK Rust 2021 TESTS 18 77 16076800
202192789 sansen B April 15, 2023, 9:35 a.m. OK Rust 2021 TESTS 18 124 15667200
202198628 hiratai B April 15, 2023, 9:47 a.m. OK Rust 2021 TESTS 18 140 20377600
202195690 Egor B April 15, 2023, 9:41 a.m. OK Rust 2021 TESTS 18 217 21504000
202268702 Jovfer B April 15, 2023, 4:41 p.m. OK Rust 2021 TESTS 19 421 9011200
202209076 WaterColor2037 B April 15, 2023, 10:11 a.m. OK Rust 2021 TESTS 18 1887 55910400

remove filters

Back to search problems