Codeforces Round 857 (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
1801 Codeforces Round 857 (Div. 1) FINISHED False 10800 58825463 March 9, 2023, 9:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6517 ) B Buying gifts PROGRAMMING data structures dp greedy sortings

B'There are n departments in the mall, each of which has exactly two stores. For convenience, we number the departments with integers from 1 to n . It is known that gifts in the first store of the i department cost a_i rubles, and in the second store of the i department -- b_i rubles. Entering the mall, Sasha will visit each of the n departments of the mall, and in each department, he will enter exactly one store. When Sasha gets into the i -th department, he will perform exactly one of two actions: Sasha is going to buy at least one gift for each friend. Moreover, he wants to pick up gifts in such a way that the price difference of the most expensive gifts bought for friends is as small as possible so that no one is offended. More formally: let m_1 be the maximum price of a gift bought to the first friend, and m_2 be the maximum price of a gift bought to the second friend. Sasha wants to choose gifts in such a way as to minimize the value of lvert m_1 - m_2 rvert . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 1 ,000 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 500 ,000 ) -- the number of departments in the mall. Each of the following n lines of each test case contains two integers a_i and b_i ( 0 <= a_i, b_i <= 10^9 ) -- the prices of gifts in the first and second store of the i department, respectively. It is guaranteed that the sum of n over all test cases does not exceed 500 ,000 . Print one integer -- the minimum price difference of the most expensive gifts bought to friends. In the first test case, Sasha has two possible options: buy a gift for the first friend in the first department, and the second friend -- in the second department, or vice versa. In the first case, '...

Tutorials

Codeforces Round #857 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
196709492 mban259 B March 9, 2023, 7:40 p.m. OK C# 10 TESTS 84 1122 37785600
196612310 KumaTachiRen B March 9, 2023, 10:06 a.m. OK C# 8 TESTS 84 2339 176844800
196613585 hos.lyric B March 9, 2023, 10:10 a.m. OK D TESTS 84 1263 63180800
196634528 yyf_0404 B March 9, 2023, 11:19 a.m. OK GNU C++14 TESTS 84 295 12902400
196611093 waaitg B March 9, 2023, 10:03 a.m. OK GNU C++14 TESTS 84 326 14028800
196672724 YeahPotato B March 9, 2023, 2:32 p.m. OK GNU C++14 TESTS 84 327 7680000
196612223 NoPotato B March 9, 2023, 10:06 a.m. OK GNU C++14 TESTS 84 327 7680000
196620068 Jormungandre B March 9, 2023, 10:31 a.m. OK GNU C++14 TESTS 84 343 18841600
196665457 The_thought_of_fallout B March 9, 2023, 1:50 p.m. OK GNU C++14 TESTS 84 374 24064000
196622734 ix35 B March 9, 2023, 10:40 a.m. OK GNU C++14 TESTS 84 389 14028800
196618075 jason_sun B March 9, 2023, 10:24 a.m. OK GNU C++14 TESTS 84 390 9011200
196611692 MakaPakka B March 9, 2023, 10:05 a.m. OK GNU C++14 TESTS 84 404 24064000
196739574 zoutong B March 10, 2023, 5:22 a.m. OK GNU C++14 TESTS 84 420 16076800
196608096 JOHNKRAM B March 9, 2023, 9:55 a.m. OK GNU C++17 TESTS 84 311 13004800
196611006 Um_nik B March 9, 2023, 10:03 a.m. OK GNU C++17 TESTS 84 358 12595200
196708183 joshi248 B March 9, 2023, 7:25 p.m. OK GNU C++17 TESTS 84 389 12697600
196614490 pl_er B March 9, 2023, 10:13 a.m. OK GNU C++17 TESTS 84 389 14233600
196611382 mickey080929 B March 9, 2023, 10:04 a.m. OK GNU C++17 TESTS 84 405 11980800
196736975 Dd2dD2 B March 10, 2023, 4:43 a.m. OK GNU C++17 TESTS 84 405 12083200
196614798 SegT1018 B March 9, 2023, 10:14 a.m. OK GNU C++17 TESTS 84 421 10035200
196730840 hzl4456 B March 10, 2023, 2:38 a.m. OK GNU C++17 TESTS 84 452 80179200
196612271 gabrielwu B March 9, 2023, 10:06 a.m. OK GNU C++17 TESTS 84 483 33280000
196736456 1459007298 B March 10, 2023, 4:33 a.m. OK GNU C++17 TESTS 84 499 44544000
196611252 torisasami B March 9, 2023, 10:03 a.m. OK GNU C++17 (64) TESTS 84 280 26521600
196719264 ns7407346 B March 9, 2023, 9:53 p.m. OK GNU C++17 (64) TESTS 84 280 38092800
196617109 TheOneYouWant B March 9, 2023, 10:21 a.m. OK GNU C++17 (64) TESTS 84 296 16588800
196671407 EasonTAO B March 9, 2023, 2:23 p.m. OK GNU C++17 (64) TESTS 84 311 16076800
196682823 AmirAli-Asgari B March 9, 2023, 3:52 p.m. OK GNU C++17 (64) TESTS 84 343 106496000
196616795 tute7627 B March 9, 2023, 10:20 a.m. OK GNU C++17 (64) TESTS 84 373 51507200
196607224 QAQAutoMaton B March 9, 2023, 9:53 a.m. OK GNU C++17 (64) TESTS 84 421 34406400
196611346 JJcjn B March 9, 2023, 10:04 a.m. OK GNU C++17 (64) TESTS 84 421 48742400
196690297 syzf2222 B March 9, 2023, 4:52 p.m. OK GNU C++17 (64) TESTS 84 483 7987200
196622011 _Peter_ B March 9, 2023, 10:38 a.m. OK GNU C++17 (64) TESTS 84 498 16076800
196725652 Turkhuuu B March 10, 2023, 12:26 a.m. OK GNU C++20 (64) TESTS 84 202 8294400
196690349 18o3 B March 9, 2023, 4:52 p.m. OK GNU C++20 (64) TESTS 84 218 8192000
196689689 18o3 B March 9, 2023, 4:47 p.m. OK GNU C++20 (64) TESTS 84 218 8192000
196674230 Unlimited_zero B March 9, 2023, 2:42 p.m. OK GNU C++20 (64) TESTS 84 218 28160000
196704676 Dhruv_Kushwaha2010 B March 9, 2023, 6:50 p.m. OK GNU C++20 (64) TESTS 84 233 8089600
196612869 platelets B March 9, 2023, 10:08 a.m. OK GNU C++20 (64) TESTS 84 233 18022400
196720722 LBR B March 9, 2023, 10:19 p.m. OK GNU C++20 (64) TESTS 84 233 46284800
196694505 ibrm B March 9, 2023, 5:25 p.m. OK GNU C++20 (64) TESTS 84 234 8089600
196602880 Golovanov399 B March 9, 2023, 9:44 a.m. OK GNU C++20 (64) TESTS 84 234 12492800
196604951 jiangly B March 9, 2023, 9:48 a.m. OK GNU C++20 (64) TESTS 84 249 8089600
196632336 insert_cool_handle B March 9, 2023, 11:12 a.m. OK Java 11 TESTS 84 1122 36249600
196637205 profchi B March 9, 2023, 11:28 a.m. OK Java 11 TESTS 84 2558 83353600
196738242 burning_summer B March 10, 2023, 5:03 a.m. OK Java 17 TESTS 84 1388 42905600
196665818 TCchen B March 9, 2023, 1:51 p.m. OK Java 17 TESTS 84 2729 66355200
196668329 Java_Programmer B March 9, 2023, 2:04 p.m. OK Java 8 TESTS 84 1169 52224000
196722325 safarisoul B March 9, 2023, 10:54 p.m. OK Java 8 TESTS 84 1185 39014400
196722033 safarisoul B March 9, 2023, 10:47 p.m. OK Java 8 TESTS 84 1232 39014400
196721681 safarisoul B March 9, 2023, 10:40 p.m. OK Java 8 TESTS 84 1263 38604800
196721885 safarisoul B March 9, 2023, 10:44 p.m. OK Java 8 TESTS 84 1278 39014400
196722094 safarisoul B March 9, 2023, 10:49 p.m. OK Java 8 TESTS 84 1279 39014400
196721548 safarisoul B March 9, 2023, 10:37 p.m. OK Java 8 TESTS 84 1341 38502400
196696515 UniversalAdmin B March 9, 2023, 5:41 p.m. OK Java 8 TESTS 84 1731 128409600
196696877 UniversalAdmin B March 9, 2023, 5:44 p.m. OK Java 8 TESTS 84 1840 128409600
196611191 iakovlev.zakhar B March 9, 2023, 10:03 a.m. OK Java 8 TESTS 84 2885 67174400
196620469 Hakiobo B March 9, 2023, 10:33 a.m. OK Kotlin 1.6 TESTS 84 779 29184000
196605099 FastFreeTask B March 9, 2023, 9:48 a.m. OK Kotlin 1.6 TESTS 84 2386 71680000
196607505 toam B March 9, 2023, 9:54 a.m. OK PyPy 3-64 TESTS 84 1465 74956800
196723747 FlakeLCR B March 9, 2023, 11:28 p.m. OK PyPy 3-64 TESTS 84 2136 96460800
196724231 xuhao95 B March 9, 2023, 11:37 p.m. OK PyPy 3-64 TESTS 84 2293 65740800
196624034 FlakeLCR B March 9, 2023, 10:44 a.m. OK PyPy 3-64 TESTS 84 2433 96563200
196669672 FlakeLCR B March 9, 2023, 2:12 p.m. OK PyPy 3-64 TESTS 84 2838 95436800
196612212 tamato B March 9, 2023, 10:06 a.m. OK PyPy 3-64 TESTS 84 2979 143462400

remove filters

Back to search problems