Codeforces Round 879 (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
1834 Codeforces Round 879 (Div. 2) FINISHED False 7200 50190863 June 18, 2023, 8:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4846 ) D Survey in Class PROGRAMMING constructive algorithms data structures greedy implementation sortings

B"Zinaida Viktorovna has n students in her history class. The homework for today included m topics, but the students had little time to prepare, so i -th student learned only topics from l_i to r_i inclusive. At the beginning of the lesson, each student holds their hand at 0 . The teacher wants to ask some topics. It goes like this: Each topic Zinaida Viktorovna can ask no more than one time. Find the maximum difference of the heights of the highest and the lowest hand that can be in class after the survey. Note that the student's hand can go below 0 . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains two integers n and m ( 2 <= n <= 10^5, 1 <= m <= 10^9 ) -- the number of students and the number of topics, respectively. Each of the next n lines of each test case contain two integers l_i and r_i ( 1 <= l_i <= r_i <= m ) -- the endpoints of the segment of topics that i -th student has learned. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print one integer -- the maximum difference of the heights of the highest and the lowest hand that can be in the class after the survey. In the first test case, Zinaida Viktorovna can ask the topics 5, 6, 7, 8 . Then the hand of the 2 -nd student will be at the height of 4 , and the hand of the 4 -th will be at the height of -2 , that is, the difference will be equal to 6 . In the second test case, you can ask about the topics 1 and 3 . Then the hand of the 1 -st student will be at the height of 2 and the hand of the 3 -rd student will be at the height of -2 . So the difference will be 4 . In the third test case, the difference between the highest a"...

Tutorials

Codeforces Round #879 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
210097956 swayingdream D June 18, 2023, 12:24 p.m. OK GNU C11 TESTS 20 46 1638400
210199519 duan19992246792 D June 19, 2023, 3:55 a.m. OK GNU C++14 TESTS 20 46 819200
210106707 XiaoSuan250 D June 18, 2023, 2:03 p.m. OK GNU C++14 TESTS 20 46 819200
210194338 sizihan D June 19, 2023, 2:06 a.m. OK GNU C++14 TESTS 20 46 819200
210106809 admin1lin2 D June 18, 2023, 2:04 p.m. OK GNU C++14 TESTS 20 61 819200
210106867 XiaoSuan250 D June 18, 2023, 2:04 p.m. OK GNU C++14 TESTS 20 62 819200
210087933 Komeiji--Koishi D June 18, 2023, 10:43 a.m. OK GNU C++14 TESTS 20 62 819200
210085424 duan19992246792 D June 18, 2023, 10:25 a.m. OK GNU C++14 TESTS 20 62 819200
210076195 dmnsn7 D June 18, 2023, 9:46 a.m. OK GNU C++14 TESTS 20 62 819200
210191432 QZJ114514 D June 19, 2023, 12:42 a.m. OK GNU C++14 TESTS 20 62 819200
210193633 54181452 D June 19, 2023, 1:47 a.m. OK GNU C++14 TESTS 20 62 819200
210192505 HarperTaylor D June 19, 2023, 1:14 a.m. OK GNU C++17 TESTS 20 62 819200
210190593 NKheyuxiang D June 19, 2023, 12:13 a.m. OK GNU C++17 TESTS 20 62 819200
210177990 archiver D June 18, 2023, 6:54 p.m. OK GNU C++17 TESTS 20 62 819200
210108360 JanBobi D June 18, 2023, 2:19 p.m. OK GNU C++17 TESTS 20 62 819200
210107256 Robshak D June 18, 2023, 2:09 p.m. OK GNU C++17 TESTS 20 62 819200
210085884 Siriushfgame D June 18, 2023, 10:28 a.m. OK GNU C++17 TESTS 20 62 819200
210085855 Manu.Stealth D June 18, 2023, 10:28 a.m. OK GNU C++17 TESTS 20 62 819200
210085357 gauss148 D June 18, 2023, 10:25 a.m. OK GNU C++17 TESTS 20 62 819200
210081713 IbrahimHabib D June 18, 2023, 10:02 a.m. OK GNU C++17 TESTS 20 62 819200
210193009 SDqwq D June 19, 2023, 1:30 a.m. OK GNU C++17 TESTS 20 62 819200
210092123 shuoxuanli D June 18, 2023, 11:23 a.m. OK GNU C++17 (64) TESTS 20 46 819200
210086279 Linver D June 18, 2023, 10:31 a.m. OK GNU C++17 (64) TESTS 20 46 819200
210084515 hhux D June 18, 2023, 10:20 a.m. OK GNU C++17 (64) TESTS 20 46 819200
210200906 OEENRS. D June 19, 2023, 4:22 a.m. OK GNU C++17 (64) TESTS 20 46 819200
210183752 cemil1234 D June 18, 2023, 8:37 p.m. OK GNU C++17 (64) TESTS 20 46 1638400
210184004 cemil1234 D June 18, 2023, 8:42 p.m. OK GNU C++17 (64) TESTS 20 46 1638400
210091412 chzu_w D June 18, 2023, 11:15 a.m. OK GNU C++17 (64) TESTS 20 46 1843200
210197602 Alex_Wei D June 19, 2023, 3:20 a.m. OK GNU C++17 (64) TESTS 20 46 1843200
210103568 fwxlj_ D June 18, 2023, 1:30 p.m. OK GNU C++17 (64) TESTS 20 46 2457600
210108126 lunatic_AJ D June 18, 2023, 2:17 p.m. OK GNU C++17 (64) TESTS 20 46 4198400
210104792 rui-de D June 18, 2023, 1:43 p.m. OK GNU C++20 (64) TESTS 20 31 819200
210107743 ForTomorrow D June 18, 2023, 2:14 p.m. OK GNU C++20 (64) TESTS 20 31 1228800
210104092 Memo_Century D June 18, 2023, 1:36 p.m. OK GNU C++20 (64) TESTS 20 31 1228800
210086536 Ferrriccc D June 18, 2023, 10:33 a.m. OK GNU C++20 (64) TESTS 20 31 8396800
210177678 dreamoon_love_AA D June 18, 2023, 6:50 p.m. OK GNU C++20 (64) TESTS 20 46 819200
210201058 hanifchdn D June 19, 2023, 4:25 a.m. OK GNU C++20 (64) TESTS 20 46 819200
210189680 MuxauJ1 D June 18, 2023, 11:38 p.m. OK GNU C++20 (64) TESTS 20 46 819200
210183774 A_G D June 18, 2023, 8:37 p.m. OK GNU C++20 (64) TESTS 20 46 819200
210177244 fmota D June 18, 2023, 6:43 p.m. OK GNU C++20 (64) TESTS 20 46 819200
210172906 wh3lll0 D June 18, 2023, 5:52 p.m. OK GNU C++20 (64) TESTS 20 46 819200
210178729 new2ac D June 18, 2023, 7:06 p.m. OK Java 11 TESTS 20 530 15974400
210088920 tbs-jyy D June 18, 2023, 10:51 a.m. OK Java 17 TESTS 20 264 409600
210078628 Masterpiece_ D June 18, 2023, 9:53 a.m. OK Java 17 TESTS 20 608 716800
210101297 Hiranmoy D June 18, 2023, 1:01 p.m. OK Java 17 TESTS 20 763 45158400
210074512 pashkinpeter D June 18, 2023, 9:40 a.m. OK Java 17 TESTS 20 795 23347200
210074797 ashanksingh1997 D June 18, 2023, 9:41 a.m. OK Java 17 TESTS 20 810 20070400
210083786 Eslam_Ahmed D June 18, 2023, 10:17 a.m. OK Java 17 TESTS 20 1544 35532800
210075306 Eslam_Ahmed D June 18, 2023, 9:43 a.m. OK Java 17 TESTS 20 1747 35942400
210200448 lpychemistry D June 19, 2023, 4:11 a.m. OK Java 8 TESTS 20 233 0
210091430 tong96 D June 18, 2023, 11:15 a.m. OK Java 8 TESTS 20 249 5222400
210085208 UniversalAdmin D June 18, 2023, 10:24 a.m. OK Java 8 TESTS 20 1153 38707200
210083946 Eslam_Ahmed D June 18, 2023, 10:18 a.m. OK Java 8 TESTS 20 1450 35020800
210154249 SlavaG D June 18, 2023, 4:04 p.m. OK Kotlin 1.7 TESTS 20 654 108851200
210155262 SlavaG D June 18, 2023, 4:07 p.m. OK Kotlin 1.7 TESTS 20 763 139673600
210096448 skimono D June 18, 2023, 12:08 p.m. OK MS C++ 2017 TESTS 20 187 1638400
210075110 kirill146 D June 18, 2023, 9:43 a.m. OK MS C++ 2017 TESTS 20 233 819200
210085574 suncup224 D June 18, 2023, 10:26 a.m. OK PyPy 3-64 TESTS 20 187 11366400
210109147 abhijeet.panihar.cse20 D June 18, 2023, 2:27 p.m. OK PyPy 3-64 TESTS 20 233 14438400
210182063 theRealChainman D June 18, 2023, 8:05 p.m. OK PyPy 3-64 TESTS 20 233 15462400
210099614 AyuAnchor D June 18, 2023, 12:42 p.m. OK PyPy 3-64 TESTS 20 233 18841600
210078594 Khaild_Salman D June 18, 2023, 9:53 a.m. OK PyPy 3-64 TESTS 20 249 10342400
210099268 eugenpaul77 D June 18, 2023, 12:38 p.m. OK PyPy 3-64 TESTS 20 265 14950400
210085774 huangxw D June 18, 2023, 10:27 a.m. OK PyPy 3-64 TESTS 20 342 29593600
210090675 Little_Sheep_Yawn D June 18, 2023, 11:08 a.m. OK PyPy 3-64 TESTS 20 343 24576000
210099229 AyuAnchor D June 18, 2023, 12:38 p.m. OK PyPy 3-64 TESTS 20 358 11571200
210101949 kavorka D June 18, 2023, 1:09 p.m. OK PyPy 3-64 TESTS 20 467 19251200
210108998 abhijeet.panihar.cse20 D June 18, 2023, 2:25 p.m. OK Python 3 TESTS 20 311 20275200
210172779 Alenochka D June 18, 2023, 5:50 p.m. OK Python 3 TESTS 20 436 19456000
210170653 margaery D June 18, 2023, 5:30 p.m. OK Python 3 TESTS 20 452 15872000
210098877 vladvalred D June 18, 2023, 12:34 p.m. OK Python 3 TESTS 20 576 20070400
210178355 vadim.golubtsov D June 18, 2023, 7 p.m. OK Python 3 TESTS 20 623 29286400
210088200 YummyPie D June 18, 2023, 10:45 a.m. OK Rust 2021 TESTS 20 31 1638400
210088829 haihamabossu D June 18, 2023, 10:50 a.m. OK Rust 2021 TESTS 20 187 11980800

remove filters

Back to search problems