Codeforces Round 940 (Div. 2) and CodeCraft-23

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
1957 Codeforces Round 940 (Div. 2) and CodeCraft-23 FINISHED False 8100 23469863 April 21, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 459 ) F2 Frequency Mismatch (Hard Version) PROGRAMMING binary search data structures dfs and similar hashing probabilities trees 2700

B'This is the hard version of the problem. The difference between the two versions of this problem is the constraint on k . You can make hacks only if all versions of the problem are solved. You are given an undirected tree of n nodes. Each node v has a value a_v written on it. You have to answer queries related to the tree. You are given q queries. In each query, you are given 5 integers, u_1, v_1, u_2, v_2, k . Denote the count of nodes with value c on path u_1 rightarrow v_1 with x_c , and the count of nodes with value c on path u_2 rightarrow v_2 with y_c . If there are z such values of c such that x_c neq y_c , output any min(z, k) such values in any order. The first line contains one integer n ( 1 <= q n <= q 10^5 ) -- the number of nodes in the tree. The next line contains n integers, a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^5 ) -- the value written on each node of the tree. Then n - 1 lines follow. Each line contains two integers u and v ( 1 <= q u, v <= q n, u neq v ) denoting an edge of the tree. It is guaranteed that the given edges form a tree. The next line contains one integer q ( 1 <= q q <= q 10^5 ) -- the number of queries. Then q lines follow. Each line contains five integers u_1, v_1, u_2, v_2, k ( 1 <= q u_1, v_1, u_2, v_2 <= q n , 1 <= q k <= q 10 ). For each query, output on a separate line. For a query, first output min(z, k) and then on the same line, output any min(z, k) values in any order which occur a different number of times in each path. For query 1 , the first path is 1 rightarrow 2 rightarrow 4 , coming across the multiset of values {5, 2, 4 } . On the second path 4 rightarrow 2 rightarrow 5 , we have the multiset {4, 2, 3 } . Two numbers -- 3 and 5 occur a different number of times'...

Tutorials

Codeforces Round #940 and CodeCraft-23 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
262465771 include_c F2 May 25, 2024, 6:08 a.m. OK C++14 (GCC 6-32) TESTS 123 780 175820800 2700
258671597 Kanosword F2 April 29, 2024, 11:05 a.m. OK C++14 (GCC 6-32) TESTS 123 827 41267200 2700
262466204 Justin666 F2 May 25, 2024, 6:12 a.m. OK C++14 (GCC 6-32) TESTS 123 843 175001600 2700
262262336 include_c F2 May 23, 2024, 1:08 p.m. OK C++14 (GCC 6-32) TESTS 123 906 48128000 2700
262264995 include_c F2 May 23, 2024, 1:27 p.m. OK C++14 (GCC 6-32) TESTS 123 921 48128000 2700
261590787 CF_xyy F2 May 19, 2024, 2:18 a.m. OK C++14 (GCC 6-32) TESTS 123 936 47718400 2700
259829017 liyouran F2 May 7, 2024, 5:33 a.m. OK C++14 (GCC 6-32) TESTS 123 983 107827200 2700
259512773 luogu_bot3 F2 May 4, 2024, 1:17 p.m. OK C++14 (GCC 6-32) TESTS 123 1171 179097600 2700
261035261 wxd114514 F2 May 15, 2024, 9:59 a.m. OK C++14 (GCC 6-32) TESTS 123 1296 101683200 2700
263222575 rotcar08 F2 May 30, 2024, 10:32 a.m. OK C++14 (GCC 6-32) TESTS 123 1374 111718400 2700
259455318 YeahPotato F2 May 4, 2024, 6:32 a.m. OK C++17 (GCC 7-32) TESTS 123 765 36761600 2700
259989502 _cly_ F2 May 8, 2024, 11:23 a.m. OK C++17 (GCC 7-32) TESTS 123 811 75264000 2700
259993690 _cly_ F2 May 8, 2024, 11:56 a.m. OK C++17 (GCC 7-32) TESTS 123 827 75264000 2700
262870474 Raisen_zhx F2 May 27, 2024, 11:20 a.m. OK C++17 (GCC 7-32) TESTS 123 858 247910400 2700
258411834 a999999 F2 April 27, 2024, 1:36 p.m. OK C++17 (GCC 7-32) TESTS 123 890 64102400 2700
259284365 luogu_bot5 F2 May 3, 2024, 1:17 a.m. OK C++17 (GCC 7-32) TESTS 123 936 68505600 2700
258805045 liujunyi2 F2 April 30, 2024, 2:44 a.m. OK C++17 (GCC 7-32) TESTS 123 936 179200000 2700
263005680 Raisen_zhx F2 May 28, 2024, 11:55 a.m. OK C++17 (GCC 7-32) TESTS 123 968 247910400 2700
262385525 _Fraction_ F2 May 24, 2024, 12:38 p.m. OK C++17 (GCC 7-32) TESTS 123 983 128614400 2700
259323562 tenkei F2 May 3, 2024, 7:02 a.m. OK C++17 (GCC 7-32) TESTS 123 1015 57753600 2700
259104627 chenhongrui F2 May 2, 2024, 9:11 a.m. OK C++20 (GCC 13-64) TESTS 123 515 71987200 2700
260206056 I_LOVE_QUYNHANH F2 May 10, 2024, 5:25 a.m. OK C++20 (GCC 13-64) TESTS 123 593 68300800 2700
258734046 Roopa_003 F2 April 29, 2024, 3:20 p.m. OK C++20 (GCC 13-64) TESTS 123 608 68300800 2700
258686749 roht F2 April 29, 2024, 12:41 p.m. OK C++20 (GCC 13-64) TESTS 123 608 68300800 2700
258492440 Extrimis F2 April 27, 2024, 8:59 p.m. OK C++20 (GCC 13-64) TESTS 123 608 68300800 2700
261666312 Sergey18 F2 May 19, 2024, 2:42 p.m. OK C++20 (GCC 13-64) TESTS 123 639 68300800 2700
258285887 scamdasca F2 April 26, 2024, 7:49 p.m. OK C++20 (GCC 13-64) TESTS 123 655 68300800 2700
258250653 fugg_jihad1sts F2 April 26, 2024, 2:52 p.m. OK C++20 (GCC 13-64) TESTS 123 655 68300800 2700
259912964 xxxdemente17 F2 May 7, 2024, 5:57 p.m. OK C++20 (GCC 13-64) TESTS 123 702 68300800 2700
260084748 Clein.qwq F2 May 9, 2024, 7:20 a.m. OK C++20 (GCC 13-64) TESTS 123 717 67788800 2700
260001369 timiss F2 May 8, 2024, 12:53 p.m. OK Kotlin 1.9 TESTS 123 3156 212480000 2700

remove filters

Back to search problems