Codeforces Round 956 (Div. 2) and ByteRace 2024

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
1983 Codeforces Round 956 (Div. 2) and ByteRace 2024 FINISHED False 8100 56042723 July 7, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 283 ) G Your Loss PROGRAMMING bitmasks brute force trees

You are given a tree with (n) nodes numbered from (1) to (n), along with an array of size (n). The value of (i)-th node is (a_{i}). There are (q) queries. In each query, you are given 2 nodes numbered as (x) and (y). Consider the path from the node numbered as (x) to the node numbered as (y). Let the path be represented by (x = p_0, p_1, p_2, \ldots, p_r = y), where (p_i) are the intermediate nodes. Compute the sum of (a_{p_i}\oplus i) for each (i) such that (0 \le i \le r) where (\oplus) is the XOR operator. More formally, compute ()\sum_{i =0}^{r} a_{p_i}\oplus i(). The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. Each test case contains several sets of input data. The first line of each set of input data contains a single integer (n) ((1 \le n \le 5 \cdot 10^5)) — the number of nodes. The next (n-1) lines of each set of input data contain (2) integers, (u) and (v) representing an edge between the node numbered (u) and the node numbered (v). It is guaranteed that (u \ne v) and that the edges form a tree. The next line of each set of input data contains (n) integers, (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 5 \cdot 10^5)) — values of the nodes. The next line contains a single integer (q) ((1 \le q \le 10^5)) — the number of queries. The next (q) lines describe the queries. The (i)-th query contains (2) integers (x) and (y) ((1 \le x,y \le n)) denoting the starting and the ending node of the path. It is guaranteed that the sum of (n) over all test cases does not exceed (5 \cdot 10^5) and sum of (q) over all test cases does not exceed (10^5). For each query, output a single number — the sum from the problem statement.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
269326371 luogu_bot3 G July 7, 2024, 11:21 p.m. OK C++14 (GCC 6-32) TESTS 100 1718 196710400
269326389 luogu_bot2 G July 7, 2024, 11:22 p.m. OK C++14 (GCC 6-32) TESTS 100 1812 196812800
269349906 Darko1 G July 8, 2024, 4:33 a.m. OK C++14 (GCC 6-32) TESTS 100 2968 101683200
269354229 qarakusi_am G July 8, 2024, 5:19 a.m. OK C++17 (GCC 7-32) TESTS 100 1390 233676800
269316200 rey10 G July 7, 2024, 8:39 p.m. OK C++17 (GCC 7-32) TESTS 100 1452 118169600
269315826 Swap-nil G July 7, 2024, 8:34 p.m. OK C++17 (GCC 7-32) TESTS 100 1452 118169600
269304098 lunchbox G July 7, 2024, 6:32 p.m. OK C++17 (GCC 7-32) TESTS 100 1781 194969600
269300392 _ChiFAN_ G July 7, 2024, 6:06 p.m. OK C++17 (GCC 7-32) TESTS 100 2093 197939200
269298143 daubi G July 7, 2024, 5:54 p.m. OK C++17 (GCC 7-32) TESTS 100 2202 141516800
269291859 Caiiii G July 7, 2024, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 100 2468 94208000
269307479 Alpha_Q G July 7, 2024, 7:02 p.m. OK C++17 (GCC 7-32) TESTS 100 2843 82841600
269347377 MIKEFENG G July 8, 2024, 4:01 a.m. OK C++20 (GCC 13-64) TESTS 100 984 267878400
269346832 MIKEFENG G July 8, 2024, 3:55 a.m. OK C++20 (GCC 13-64) TESTS 100 1124 267878400
269306810 PurpleCrayon G July 7, 2024, 6:55 p.m. OK C++20 (GCC 13-64) TESTS 100 1140 248422400
269325731 rgnerdplayer G July 7, 2024, 11:07 p.m. OK C++20 (GCC 13-64) TESTS 100 1171 159948800
269291383 fmota G July 7, 2024, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 100 1234 233779200
269287578 tfg G July 7, 2024, 4:35 p.m. OK C++20 (GCC 13-64) TESTS 100 1249 168960000
269306526 marvinthang G July 7, 2024, 6:53 p.m. OK C++20 (GCC 13-64) TESTS 100 1249 199782400
269304269 ndt23 G July 7, 2024, 6:33 p.m. OK C++20 (GCC 13-64) TESTS 100 1249 199782400
269341575 LNian G July 8, 2024, 3:02 a.m. OK C++20 (GCC 13-64) TESTS 100 1264 265318400
269347653 fadhilmauludi G July 8, 2024, 4:04 a.m. OK C++20 (GCC 13-64) TESTS 100 1311 198348800
269299581 Tlatoani G July 7, 2024, 6:01 p.m. OK Rust 2021 TESTS 100 1577 253644800

remove filters

Back to search problems