Codeforces Round 820 (Div. 3)

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
1729 Codeforces Round 820 (Div. 3) FINISHED False 8100 74186663 Sept. 12, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 21943 ) D Friends and the Restaurant PROGRAMMING greedy two pointers #Jumping on tiles

B'A group of n friends decide to go to a restaurant. Each of the friends plans to order meals for x_i burles and has a total of y_i burles ( 1 <= i <= n ). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaurant. Each of the friends visits the restaurant no more than once (that is, these groups do not intersect). These groups must satisfy the condition that the total budget of each group must be not less than the amount of burles that the friends in the group are going to spend at the restaurant. In other words, the sum of all x_i values in the group must not exceed the sum of y_i values in the group. What is the maximum number of days friends can visit the restaurant? For example, let there be n = 6 friends for whom x = [ 8, 3, 9, 2, 4, 5 ] and y = [ 5, 3, 1, 4, 5, 10 ]. Then: It can be shown that they will not be able to form more groups so that each group has at least two friends and each group can pay the bill. So, the maximum number of groups the friends can split into is 2 . Friends will visit the restaurant for a maximum of two days. Note that the 3 -rd friend will not visit the restaurant at all. Output the maximum number of days the friends can visit the restaurant for given n , x and y . The first line of the input contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer n ( 2 <= n <= 10^5 ) -- the number of friends. The second line of each test case contains exactly n integers x_1, x_2, ... , x_n ( 1 <= x_i <= 10^9 ). The value of x_i corresponds to the number of burles that the friend numbered i plans to spend at the restaurant. The third line of each test case contains exactly n inte'...

Tutorials

Codeforces Round #820 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
171986152 bluemegane D Sept. 13, 2022, 3:28 a.m. OK C# 8 TESTS 7 187 19148800
171992092 zzzxy_xun D Sept. 13, 2022, 5:12 a.m. OK GNU C++14 TESTS 7 46 409600
171980849 AFnaN_91 D Sept. 13, 2022, 1:30 a.m. OK GNU C++14 TESTS 7 46 409600
171990397 Iamlgs D Sept. 13, 2022, 4:47 a.m. OK GNU C++14 TESTS 7 46 819200
171971745 Yash983 D Sept. 12, 2022, 9:07 p.m. OK GNU C++14 TESTS 7 46 1228800
171948773 zwu2021016339 D Sept. 12, 2022, 5:05 p.m. OK GNU C++14 TESTS 6 46 1843200
171979533 behuymummim D Sept. 13, 2022, 12:55 a.m. OK GNU C++14 TESTS 7 61 819200
171993201 MNKG D Sept. 13, 2022, 5:29 a.m. OK GNU C++14 TESTS 7 61 1228800
171989089 remmymilkyway D Sept. 13, 2022, 4:25 a.m. OK GNU C++14 TESTS 7 61 1228800
171986467 next_here D Sept. 13, 2022, 3:35 a.m. OK GNU C++14 TESTS 7 61 1228800
171957811 atharva_0307 D Sept. 12, 2022, 6:07 p.m. OK GNU C++14 TESTS 6 61 1228800
171970646 Kamel_Mohammed D Sept. 12, 2022, 8:46 p.m. OK GNU C++17 TESTS 7 46 409600
171948480 Tabel D Sept. 12, 2022, 5:04 p.m. OK GNU C++17 TESTS 6 46 409600
171966816 abdallah_moemen D Sept. 12, 2022, 7:45 p.m. OK GNU C++17 TESTS 7 46 819200
171967546 akarsharora.88 D Sept. 12, 2022, 7:55 p.m. OK GNU C++17 TESTS 7 46 1228800
171951217 Mo7amed_Alaa D Sept. 12, 2022, 5:17 p.m. OK GNU C++17 TESTS 6 46 1228800
171972237 Schrody D Sept. 12, 2022, 9:17 p.m. OK GNU C++17 TESTS 7 46 3686400
171977202 b4nd1t D Sept. 12, 2022, 11:42 p.m. OK GNU C++17 TESTS 7 61 409600
171968278 madhav_748 D Sept. 12, 2022, 8:05 p.m. OK GNU C++17 TESTS 7 61 409600
171950212 Mohammed_faizan D Sept. 12, 2022, 5:12 p.m. OK GNU C++17 TESTS 6 61 409600
171985998 huuminh365 D Sept. 13, 2022, 3:25 a.m. OK GNU C++17 TESTS 7 61 819200
171990738 drdilyor D Sept. 13, 2022, 4:52 a.m. OK GNU C++17 (64) TESTS 7 31 1228800
171964992 Zuka D Sept. 12, 2022, 7:21 p.m. OK GNU C++17 (64) TESTS 6 31 1433600
171977682 CodingKnight D Sept. 13, 2022, 12:01 a.m. OK GNU C++17 (64) TESTS 7 46 409600
171977650 CodingKnight D Sept. 13, 2022, midnight OK GNU C++17 (64) TESTS 7 46 409600
171971127 islam231 D Sept. 12, 2022, 8:55 p.m. OK GNU C++17 (64) TESTS 7 46 409600
171959971 JohanWOW D Sept. 12, 2022, 6:27 p.m. OK GNU C++17 (64) TESTS 6 46 409600
171985018 1potato2potato D Sept. 13, 2022, 3:06 a.m. OK GNU C++17 (64) TESTS 7 46 819200
171967380 gehadwael099 D Sept. 12, 2022, 7:52 p.m. OK GNU C++17 (64) TESTS 7 46 819200
171967331 ChairmanFMao D Sept. 12, 2022, 7:52 p.m. OK GNU C++17 (64) TESTS 7 46 819200
171994132 IBoger D Sept. 13, 2022, 5:42 a.m. OK GNU C++17 (64) TESTS 7 46 1126400
171992802 MLP31377121142857 D Sept. 13, 2022, 5:23 a.m. OK GNU C++20 (64) TESTS 7 31 409600
171989976 SunnyRockzz D Sept. 13, 2022, 4:39 a.m. OK GNU C++20 (64) TESTS 7 31 409600
171982967 Akib_2612 D Sept. 13, 2022, 2:21 a.m. OK GNU C++20 (64) TESTS 7 31 409600
171979980 50NH41 D Sept. 13, 2022, 1:07 a.m. OK GNU C++20 (64) TESTS 7 31 409600
171950954 amgadabdelrahman831 D Sept. 12, 2022, 5:16 p.m. OK GNU C++20 (64) TESTS 6 31 409600
171978956 breakcoder D Sept. 13, 2022, 12:39 a.m. OK GNU C++20 (64) TESTS 7 31 614400
171990248 PeterShatokhin D Sept. 13, 2022, 4:44 a.m. OK GNU C++20 (64) TESTS 7 31 819200
171985313 HONG-LOU-TEA D Sept. 13, 2022, 3:12 a.m. OK GNU C++20 (64) TESTS 7 31 819200
171984391 abdo_fatah88 D Sept. 13, 2022, 2:53 a.m. OK GNU C++20 (64) TESTS 7 31 819200
171977002 DinarPerseus D Sept. 12, 2022, 11:34 p.m. OK GNU C++20 (64) TESTS 7 31 819200
171982770 nis1234 D Sept. 13, 2022, 2:17 a.m. OK Java 11 TESTS 7 186 0
171966718 ushikawa D Sept. 12, 2022, 7:43 p.m. OK Java 11 TESTS 7 233 0
171952934 leoncn D Sept. 12, 2022, 5:28 p.m. OK Java 11 TESTS 6 233 0
171992391 camt_bot D Sept. 13, 2022, 5:17 a.m. OK Java 11 TESTS 7 233 102400
171994867 unfixedbug D Sept. 13, 2022, 5:51 a.m. OK Java 11 TESTS 7 249 0
171989676 yogii_123 D Sept. 13, 2022, 4:34 a.m. OK Java 11 TESTS 7 249 0
171983789 aditya2024 D Sept. 13, 2022, 2:39 a.m. OK Java 11 TESTS 7 249 0
171946483 nbhakar D Sept. 12, 2022, 4:56 p.m. OK Java 11 TESTS 6 249 0
171946048 aditigupta4138 D Sept. 12, 2022, 4:55 p.m. OK Java 11 TESTS 6 264 0
171948915 kasiru_69 D Sept. 12, 2022, 5:06 p.m. OK Java 11 TESTS 6 265 0
171976583 LeetCodeforces_Null D Sept. 12, 2022, 11:19 p.m. OK Java 17 TESTS 7 343 6758400
171946360 Lifencev D Sept. 12, 2022, 4:56 p.m. OK Java 17 TESTS 6 530 0
171956859 nurs13 D Sept. 12, 2022, 5:59 p.m. OK Java 17 TESTS 6 560 819200
171993509 AdityaGupta19 D Sept. 13, 2022, 5:33 a.m. OK Java 17 TESTS 7 561 409600
171962478 Mohamed_A7med D Sept. 12, 2022, 6:53 p.m. OK Java 8 TESTS 6 155 2867200
171948264 DylanSmith D Sept. 12, 2022, 5:03 p.m. OK Java 8 TESTS 6 171 3481600
171980744 Jinxuran D Sept. 13, 2022, 1:27 a.m. OK Java 8 TESTS 7 187 3072000
171958619 kalsitushar D Sept. 12, 2022, 6:14 p.m. OK Java 8 TESTS 6 187 3072000
171957722 pranayrana14 D Sept. 12, 2022, 6:07 p.m. OK Java 8 TESTS 6 202 4505600
171954385 sj07032003 D Sept. 12, 2022, 5:39 p.m. OK Java 8 TESTS 6 358 0
171983300 Owl0000 D Sept. 13, 2022, 2:28 a.m. OK Java 8 TESTS 7 389 0
171982171 zhouzelin D Sept. 13, 2022, 2:01 a.m. OK Java 8 TESTS 7 389 0
171985042 6ziv D Sept. 13, 2022, 3:06 a.m. OK MS C++ 2017 TESTS 7 77 409600
171947175 cjh970422 D Sept. 12, 2022, 4:59 p.m. OK MS C++ 2017 TESTS 6 171 1228800
171984562 Kaiii D Sept. 13, 2022, 2:56 a.m. OK MS C++ 2017 TESTS 7 186 1228800
171951876 Oleja123 D Sept. 12, 2022, 5:21 p.m. OK MS C++ 2017 TESTS 6 187 1945600
171953852 Ahmedmadbouly186 D Sept. 12, 2022, 5:35 p.m. OK MS C++ 2017 TESTS 6 545 3993600
171981057 Liberator187 D Sept. 13, 2022, 1:36 a.m. OK PyPy 3 TESTS 7 171 17408000
171977128 Jvaeyhcd D Sept. 12, 2022, 11:39 p.m. OK PyPy 3 TESTS 7 265 14131200
171970216 sami02jain D Sept. 12, 2022, 8:38 p.m. OK PyPy 3 TESTS 7 326 16281600
171961068 vim1729 D Sept. 12, 2022, 6:38 p.m. OK PyPy 3 TESTS 6 342 16691200
171958257 vadlamani19100 D Sept. 12, 2022, 6:11 p.m. OK PyPy 3 TESTS 6 404 15257600
171964658 _Saacosta D Sept. 12, 2022, 7:17 p.m. OK PyPy 3 TESTS 6 451 15769600
171946456 MD_MASUM_BILLAH D Sept. 12, 2022, 4:56 p.m. OK PyPy 3 TESTS 6 467 13926400
171958082 RedSpica D Sept. 12, 2022, 6:10 p.m. OK PyPy 3 TESTS 6 499 15052800
171982276 kelagnir D Sept. 13, 2022, 2:03 a.m. OK PyPy 3 TESTS 7 499 15462400
171947256 gesuta D Sept. 12, 2022, 4:59 p.m. OK PyPy 3-64 TESTS 6 108 19763200
171972764 satyamshrma D Sept. 12, 2022, 9:30 p.m. OK PyPy 3-64 TESTS 7 124 22937600
171947199 Uzdik D Sept. 12, 2022, 4:59 p.m. OK PyPy 3-64 TESTS 6 124 25702400
171959821 dyppp D Sept. 12, 2022, 6:26 p.m. OK PyPy 3-64 TESTS 6 140 22732800
171983641 dereshy D Sept. 13, 2022, 2:36 a.m. OK PyPy 3-64 TESTS 7 155 23142400
171974128 alxwen711 D Sept. 12, 2022, 10:03 p.m. OK PyPy 3-64 TESTS 7 202 20172800
171986875 samchen123 D Sept. 13, 2022, 3:44 a.m. OK PyPy 3-64 TESTS 7 202 20275200
171969322 bokunopicolo D Sept. 12, 2022, 8:23 p.m. OK PyPy 3-64 TESTS 7 202 25907200
171989034 bebo123456 D Sept. 13, 2022, 4:23 a.m. OK PyPy 3-64 TESTS 7 233 17100800
171992001 USYDLDH D Sept. 13, 2022, 5:11 a.m. OK PyPy 3-64 TESTS 7 233 27136000
171969173 NenadDapic D Sept. 12, 2022, 8:20 p.m. OK Python 3 TESTS 7 156 10752000
171948664 abhi_6901 D Sept. 12, 2022, 5:05 p.m. OK Python 3 TESTS 6 171 10547200
171948191 ankit_xyz D Sept. 12, 2022, 5:03 p.m. OK Python 3 TESTS 6 171 10547200
171948456 gandesaikiran8902 D Sept. 12, 2022, 5:04 p.m. OK Python 3 TESTS 6 186 10752000
171946028 saurabhatlantis D Sept. 12, 2022, 4:55 p.m. OK Python 3 TESTS 6 186 10752000
171963519 AhmdJabr D Sept. 12, 2022, 7:04 p.m. OK Python 3 TESTS 6 187 10752000
171972175 21bec036 D Sept. 12, 2022, 9:16 p.m. OK Python 3 TESTS 7 202 10752000
171980544 retard_qwq D Sept. 13, 2022, 1:23 a.m. OK Python 3 TESTS 7 202 11059200
171963744 Jassi_2003 D Sept. 12, 2022, 7:07 p.m. OK Python 3 TESTS 6 217 10752000
171950778 shreyas.pande2003 D Sept. 12, 2022, 5:15 p.m. OK Python 3 TESTS 6 217 11468800

remove filters

Back to search problems