Codeforces Round 831 (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
1740 Codeforces Round 831 (Div. 1 + Div. 2) FINISHED False 9900 70145363 Oct. 29, 2022, 9:10 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4473 ) E Hanging Hearts PROGRAMMING constructive algorithms data structures dfs and similar dp greedy trees 1800

B'Pak Chanek has n blank heart-shaped cards. Card 1 is attached directly to the wall while each of the other cards is hanging onto exactly one other card by a piece of string. Specifically, card i ( i > 1 ) is hanging onto card p_i ( p_i < i ). In the very beginning, Pak Chanek must write one integer number on each card. He does this by choosing any permutation a of [1, 2, ... , n] . Then, the number written on card i is a_i . After that, Pak Chanek must do the following operation n times while maintaining a sequence s (which is initially empty): After that, Pak Chanek will have a sequence s with n elements. What is the maximum length of the longest non-decreasing subsequence ^ dagger of s at the end if Pak Chanek does all the steps optimally? ^ dagger A sequence b is a subsequence of a sequence c if b can be obtained from c by deletion of several (possibly, zero or all) elements. For example, [3,1] is a subsequence of [3,2,1] , [4,3,1] and [3,1] , but not [1,3,3,7] and [3,10,4] . The first line contains a single integer n ( 2 <= n <= 10^5 ) -- the number of heart-shaped cards. The second line contains n - 1 integers p_2, p_3, ... , p_n ( 1 <= p_i < i ) describing which card that each card hangs onto. Print a single integer -- the maximum length of the longest non-decreasing subsequence of s at the end if Pak Chanek does all the steps optimally. The following is the structure of the cards in the first example. Pak Chanek can choose the permutation a = [1, 5, 4, 3, 2, 6] . Let w_i be the number written on card i . Initially, w_i = a_i . Pak Chanek can do the following operations in order: One of the longest non-decreasing subsequences of s = [2, 6, 2, 4, 4, 1] is [2, 2, 4, 4] . Thus, the length of the longest non-decreasing subsequence of'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
178466693 Tom66 E Oct. 30, 2022, 3:31 a.m. OK GNU C++14 TESTS 65 31 1843200 1800
178424559 minhsn22 E Oct. 29, 2022, 3:52 p.m. OK GNU C++14 TESTS 65 46 1228800 1800
178430813 qfl_zzz E Oct. 29, 2022, 4:38 p.m. OK GNU C++14 TESTS 65 46 2457600 1800
178424306 Jr-zlw E Oct. 29, 2022, 3:49 p.m. OK GNU C++14 TESTS 65 46 3993600 1800
178442982 SuperJ6 E Oct. 29, 2022, 6:36 p.m. OK GNU C++14 TESTS 65 46 4198400 1800
178461207 SAA0817 E Oct. 30, 2022, 12:20 a.m. OK GNU C++14 TESTS 65 46 7577600 1800
178392467 littlestarQwQ E Oct. 29, 2022, 11:47 a.m. OK GNU C++14 TESTS 65 46 7577600 1800
178391255 Belief_yfly E Oct. 29, 2022, 11:43 a.m. OK GNU C++14 TESTS 65 46 8396800 1800
178402663 ReTlaCe E Oct. 29, 2022, 12:54 p.m. OK GNU C++14 TESTS 65 46 8601600 1800
178398513 ftuknights E Oct. 29, 2022, 12:35 p.m. OK GNU C++14 TESTS 65 46 8601600 1800
178465623 acwing_meow E Oct. 30, 2022, 2:59 a.m. OK GNU C++17 TESTS 65 31 4812800 1800
178462196 Loveforever E Oct. 30, 2022, 1:01 a.m. OK GNU C++17 TESTS 65 46 1228800 1800
178456004 Maxymilian E Oct. 29, 2022, 9:33 p.m. OK GNU C++17 TESTS 65 46 1228800 1800
178419117 Chenyu_Qiu E Oct. 29, 2022, 3:02 p.m. OK GNU C++17 TESTS 65 46 1228800 1800
178407950 zja601 E Oct. 29, 2022, 1:34 p.m. OK GNU C++17 TESTS 65 46 1228800 1800
178403585 CodingCat E Oct. 29, 2022, 1 p.m. OK GNU C++17 TESTS 65 46 3584000 1800
178429410 Savelij E Oct. 29, 2022, 4:36 p.m. OK GNU C++17 TESTS 65 46 4403200 1800
178409243 _priyanshu_ E Oct. 29, 2022, 1:43 p.m. OK GNU C++17 TESTS 65 46 5427200 1800
178394960 bread_amonger E Oct. 29, 2022, 11:54 a.m. OK GNU C++17 TESTS 65 46 6656000 1800
178424226 Haven_ E Oct. 29, 2022, 3:49 p.m. OK GNU C++17 TESTS 65 46 6758400 1800
178398545 Superposition E Oct. 29, 2022, 12:35 p.m. OK GNU C++17 (64) TESTS 65 46 6963200 1800
178389640 OnMyZenith E Oct. 29, 2022, 11:37 a.m. OK GNU C++17 (64) TESTS 65 46 7168000 1800
178390507 sg60 E Oct. 29, 2022, 11:41 a.m. OK GNU C++17 (64) TESTS 65 46 12083200 1800
178469517 NanZaaa E Oct. 30, 2022, 4:40 a.m. OK GNU C++17 (64) TESTS 65 46 12800000 1800
178422450 hzy0227 E Oct. 29, 2022, 3:33 p.m. OK GNU C++17 (64) TESTS 65 46 12800000 1800
178462716 enslaved E Oct. 30, 2022, 1:22 a.m. OK GNU C++17 (64) TESTS 65 46 15667200 1800
178387744 cuzperf E Oct. 29, 2022, 11:33 a.m. OK GNU C++17 (64) TESTS 65 46 15667200 1800
178400514 jjjjssss6 E Oct. 29, 2022, 12:41 p.m. OK GNU C++17 (64) TESTS 65 46 15974400 1800
178464507 cuom1999 E Oct. 30, 2022, 2:26 a.m. OK GNU C++17 (64) TESTS 65 46 16076800 1800
178401506 shouxhy E Oct. 29, 2022, 12:47 p.m. OK GNU C++17 (64) TESTS 65 46 16076800 1800
178466388 zx081325 E Oct. 30, 2022, 3:23 a.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178438292 A_G E Oct. 29, 2022, 5:49 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178427890 flying_doraemon E Oct. 29, 2022, 4:22 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178427107 hijkl2e E Oct. 29, 2022, 4:14 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178422210 baddog E Oct. 29, 2022, 3:30 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178412625 freakin23 E Oct. 29, 2022, 2:08 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178411133 hijkl2e E Oct. 29, 2022, 1:57 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178410064 Tiphereth-A E Oct. 29, 2022, 1:49 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178407540 kwm_t E Oct. 29, 2022, 1:31 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178401382 stalker120 E Oct. 29, 2022, 12:46 p.m. OK GNU C++20 (64) TESTS 65 31 1228800 1800
178427177 ac9117033 E Oct. 29, 2022, 4:15 p.m. OK Java 11 TESTS 65 405 79462400 1800
178464201 kkz666 E Oct. 30, 2022, 2:16 a.m. OK Java 17 TESTS 65 295 16896000 1800
178392439 TCchen E Oct. 29, 2022, 11:47 a.m. OK Java 17 TESTS 65 311 14131200 1800
178404422 merlin_ E Oct. 29, 2022, 1:07 p.m. OK Java 17 TESTS 65 436 49664000 1800
178457783 leonlian E Oct. 29, 2022, 10:14 p.m. OK Java 8 TESTS 65 171 15462400 1800
178458182 leonlian E Oct. 29, 2022, 10:26 p.m. OK Java 8 TESTS 65 171 15564800 1800
178392393 ChenHuaXin E Oct. 29, 2022, 11:47 a.m. OK Java 8 TESTS 65 249 31641600 1800
178405970 youtsuha E Oct. 29, 2022, 1:19 p.m. OK Java 8 TESTS 65 326 79769600 1800
178393322 youtsuha2.0 E Oct. 29, 2022, 11:49 a.m. OK Java 8 TESTS 65 326 79769600 1800
178391999 liomsv E Oct. 29, 2022, 11:46 a.m. OK Java 8 TESTS 65 342 79257600 1800
178407303 ikillmyself E Oct. 29, 2022, 1:29 p.m. OK Java 8 TESTS 65 374 73420800 1800
178393149 UniversalAdmin E Oct. 29, 2022, 11:49 a.m. OK Java 8 TESTS 65 560 46284800 1800
178422217 TheGoodest E Oct. 29, 2022, 3:30 p.m. OK MS C++ 2017 TESTS 65 93 11673600 1800
178421603 TheGoodest E Oct. 29, 2022, 3:25 p.m. OK MS C++ 2017 TESTS 65 108 10444800 1800
178406707 TheGoodest E Oct. 29, 2022, 1:25 p.m. OK MS C++ 2017 TESTS 65 109 9625600 1800
178404514 XYShaoKang E Oct. 29, 2022, 1:07 p.m. OK Node.js TESTS 65 93 9216000 1800
178422252 bcollet E Oct. 29, 2022, 3:31 p.m. OK PyPy 2 TESTS 65 249 11571200 1800
178391340 hxu10 E Oct. 29, 2022, 11:43 a.m. OK PyPy 3 TESTS 65 218 13516800 1800
178433719 lionel.m E Oct. 29, 2022, 5:06 p.m. OK PyPy 3-64 TESTS 65 93 12492800 1800
178410029 peterwuyihong E Oct. 29, 2022, 1:49 p.m. OK PyPy 3-64 TESTS 65 93 12492800 1800
178387599 lzumiorito E Oct. 29, 2022, 11:33 a.m. OK PyPy 3-64 TESTS 65 326 31334400 1800
178414909 Issin E Oct. 29, 2022, 2:26 p.m. OK PyPy 3-64 TESTS 65 327 27340800 1800
178392310 KuzlyaevNikita E Oct. 29, 2022, 11:47 a.m. OK PyPy 3-64 TESTS 65 374 33894400 1800
178390217 huikang E Oct. 29, 2022, 11:39 a.m. OK PyPy 3-64 TESTS 65 405 32665600 1800
178393513 sbit E Oct. 29, 2022, 11:50 a.m. OK Rust 2021 TESTS 65 31 3788800 1800
178393730 liut E Oct. 29, 2022, 11:50 a.m. OK Rust 2021 TESTS 65 46 22425600 1800
178393295 avnyu E Oct. 29, 2022, 11:49 a.m. OK Rust 2021 TESTS 65 62 25804800 1800

remove filters

Back to search problems