Codeforces Round 621 (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
1307 Codeforces Round 621 (Div. 1 + Div. 2) FINISHED False 8100 149869499 Feb. 17, 2020, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1287 ) E Cow and Treats PROGRAMMING binary search combinatorics dp greedy implementation math 2400

B'After a successful year of milk production, Farmer John is rewarding his cows with their favorite treat: tasty grass! On the field, there is a row of n units of grass, each with a sweetness s_i . Farmer John has m cows, each with a favorite sweetness f_i and a hunger value h_i . He would like to pick two disjoint subsets of cows to line up on the left and right side of the grass row. There is no restriction on how many cows must be on either side. The cows will be treated in the following manner: Note that grass does not grow back. Also, to prevent cows from getting upset, not every cow has to feed since FJ can choose a subset of them. Surprisingly, FJ has determined that sleeping cows are the most satisfied. If FJ orders optimally, what is the maximum number of sleeping cows that can result, and how many ways can FJ choose the subset of cows on the left and right side to achieve that maximum number of sleeping cows (modulo 10^9+7 )? The order in which FJ sends the cows does not matter as long as no cows get upset. The first line contains two integers n and m ( 1 <= n <= 5000 , 1 <= m <= 5000 ) -- the number of units of grass and the number of cows. The second line contains n integers s_1, s_2, ldots, s_n ( 1 <= s_i <= n ) -- the sweetness values of the grass. The i -th of the following m lines contains two integers f_i and h_i ( 1 <= f_i, h_i <= n ) -- the favorite sweetness and hunger value of the i -th cow. No two cows have the same hunger and favorite sweetness simultaneously. Output two integers -- the maximum number of sleeping cows that can result and the number of ways modulo 10^9+7 . In the first example, FJ can line up the cows as follows to achieve 2 sleeping cows: In the second example, FJ can line up the cows as follows to achieve 1 sleeping cow: In the third example, FJ can line up the cows as foll'...

Tutorials

Codeforces Round #621 (Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
71342419 rainboy E Feb. 17, 2020, 9:24 p.m. OK GNU C11 TESTS 57 218 204800 2400
71408197 pkh68 E Feb. 19, 2020, 12:27 a.m. OK GNU C++11 TESTS 57 31 204800 2400
71352686 s_r_f E Feb. 18, 2020, 4:44 a.m. OK GNU C++11 TESTS 57 31 5734400 2400
71363013 cyx13935786602 E Feb. 18, 2020, 8:18 a.m. OK GNU C++11 TESTS 57 31 16076800 2400
71430311 YU1 E Feb. 19, 2020, 10:40 a.m. OK GNU C++11 TESTS 57 46 204800 2400
71439357 Kaizyn E Feb. 19, 2020, 1:22 p.m. OK GNU C++11 TESTS 58 46 204800 2400
71337199 cookiedoth E Feb. 17, 2020, 7:28 p.m. OK GNU C++11 TESTS 57 46 512000 2400
71349726 Ruki E Feb. 18, 2020, 3:04 a.m. OK GNU C++11 TESTS 57 46 512000 2400
71359097 jxdxhy E Feb. 18, 2020, 7:03 a.m. OK GNU C++11 TESTS 57 46 1433600 2400
71573028 SaRcAsTiC_CoDeRr E Feb. 21, 2020, 7:51 p.m. OK GNU C++11 TESTS 58 46 3276800 2400
71340629 FieryPhoenix E Feb. 17, 2020, 8:34 p.m. OK GNU C++11 TESTS 57 62 8089600 2400
71362003 heyuhhh E Feb. 18, 2020, 7:58 a.m. OK GNU C++14 TESTS 57 31 409600 2400
71600156 ArshiaDadras E Feb. 22, 2020, 9:01 a.m. OK GNU C++14 TESTS 58 31 409600 2400
71502064 szw720711 E Feb. 20, 2020, 3:08 p.m. OK GNU C++14 TESTS 58 31 614400 2400
71409568 elManco E Feb. 19, 2020, 1:51 a.m. OK GNU C++14 TESTS 57 46 409600 2400
71372882 theStaticMind E Feb. 18, 2020, 11:36 a.m. OK GNU C++14 TESTS 57 46 512000 2400
71362701 Potassium_ E Feb. 18, 2020, 8:12 a.m. OK GNU C++14 TESTS 57 46 100761600 2400
71324066 kotatsugame E Feb. 17, 2020, 5:20 p.m. OK GNU C++14 TESTS 57 124 100352000 2400
71322813 sava-cska E Feb. 17, 2020, 5:15 p.m. OK GNU C++14 TESTS 57 170 201216000 2400
71333909 snow39 E Feb. 17, 2020, 6:50 p.m. OK GNU C++14 TESTS 57 171 409600 2400
71414763 silxi E Feb. 19, 2020, 5:06 a.m. OK GNU C++14 TESTS 57 171 716800 2400
71521299 zzxzxzzxz E Feb. 21, 2020, 12:09 a.m. OK GNU C++17 TESTS 58 31 409600 2400
71345858 ecnerwala E Feb. 18, 2020, 12:05 a.m. OK GNU C++17 TESTS 57 31 512000 2400
71345831 ecnerwala E Feb. 18, 2020, 12:04 a.m. OK GNU C++17 TESTS 57 31 512000 2400
71468683 DrSwad E Feb. 20, 2020, 2:15 a.m. OK GNU C++17 TESTS 58 31 512000 2400
71338354 jiangly E Feb. 17, 2020, 7:46 p.m. OK GNU C++17 TESTS 57 31 512000 2400
71441209 despair E Feb. 19, 2020, 1:51 p.m. OK GNU C++17 TESTS 58 31 614400 2400
71361360 RedTea E Feb. 18, 2020, 7:45 a.m. OK GNU C++17 TESTS 57 31 819200 2400
71422291 wythend E Feb. 19, 2020, 8 a.m. OK GNU C++17 TESTS 57 46 409600 2400
71548344 Lucina E Feb. 21, 2020, 12:12 p.m. OK GNU C++17 TESTS 58 46 409600 2400
71492848 emthrm E Feb. 20, 2020, 12:37 p.m. OK GNU C++17 TESTS 58 46 409600 2400
71368265 wzazzy E Feb. 18, 2020, 10:01 a.m. OK Go TESTS 57 358 100454400 2400
71328749 uwi E Feb. 17, 2020, 5:39 p.m. OK Java 11 TESTS 57 499 147148800 2400
71342232 Dukkha E Feb. 17, 2020, 9:18 p.m. OK Java 11 TESTS 57 716 0 2400
71502167 Ti4oVolchara E Feb. 20, 2020, 3:10 p.m. OK Java 11 TESTS 58 826 0 2400
71502227 Ti4oVolchara E Feb. 20, 2020, 3:10 p.m. OK Java 11 TESTS 58 842 0 2400
71501620 Ti4oVolchara E Feb. 20, 2020, 3 p.m. OK Java 11 TESTS 58 982 0 2400
71523259 Tomg E Feb. 21, 2020, 2:04 a.m. OK Java 8 TESTS 58 155 0 2400
71377719 dalt E Feb. 18, 2020, 12:53 p.m. OK Java 8 TESTS 57 171 20172800 2400
71400362 polyakoff E Feb. 18, 2020, 7:16 p.m. OK Java 8 TESTS 57 545 0 2400
71398097 polyakoff E Feb. 18, 2020, 6:30 p.m. OK Java 8 TESTS 57 545 0 2400
71383855 DarLam E Feb. 18, 2020, 2:20 p.m. OK Java 8 TESTS 57 592 0 2400
71407886 barakraganosungam E Feb. 19, 2020, 12:08 a.m. OK Java 8 TESTS 57 592 152166400 2400
71341803 Harpae E Feb. 17, 2020, 9:05 p.m. OK Java 8 TESTS 57 607 0 2400
71321113 Lewin E Feb. 17, 2020, 5:08 p.m. OK Java 8 TESTS 57 623 142438400 2400
71329803 Xylenox E Feb. 17, 2020, 5:43 p.m. OK Java 8 TESTS 57 951 0 2400
71312657 Nutella3000 E Feb. 17, 2020, 4:37 p.m. OK Java 8 TESTS 57 951 144281600 2400
71429921 Spheniscine E Feb. 19, 2020, 10:32 a.m. OK Kotlin TESTS 57 171 1126400 2400
71428716 Spheniscine E Feb. 19, 2020, 10:10 a.m. OK Kotlin TESTS 57 171 1126400 2400
71329435 darnley E Feb. 17, 2020, 5:42 p.m. OK Kotlin TESTS 57 530 307200 2400
71338955 darnley E Feb. 17, 2020, 7:56 p.m. OK Kotlin TESTS 57 624 409600 2400
71340868 darnley E Feb. 17, 2020, 8:39 p.m. OK Kotlin TESTS 57 655 512000 2400
71334496 Tlatoani E Feb. 17, 2020, 6:54 p.m. OK Kotlin TESTS 57 904 102400 2400
71341059 darnley E Feb. 17, 2020, 8:45 p.m. OK Kotlin TESTS 57 982 614400 2400
71359217 lxhgww E Feb. 18, 2020, 7:06 a.m. OK MS C++ TESTS 57 420 200704000 2400
71351747 sansen E Feb. 18, 2020, 4:15 a.m. OK Rust TESTS 57 249 409600 2400
71336578 EbTech E Feb. 17, 2020, 7:18 p.m. OK Rust TESTS 57 358 614400 2400
71336719 EbTech E Feb. 17, 2020, 7:20 p.m. OK Rust TESTS 57 374 614400 2400
71333930 EbTech E Feb. 17, 2020, 6:50 p.m. OK Rust TESTS 57 545 614400 2400

remove filters

Back to search problems