Codeforces Round 1103 (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
2236 Codeforces Round 1103 (Div. 3) FINISHED False 9000 6189914 June 12, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 424 ) G Criterion in Burlandia PROGRAMMING brute force data structures implementation

Regions in Burlandia form a graph with (n) vertices and (n-1) edges, and there is exactly one path between any two vertices. Formally, the regions form a tree. Each region has a friendliness value (a_i). There are (q) queries. In each query, a pair of friends located in different regions is given. They want to know how many subsegments of the path between these regions are hospitable . It is known that in Burlandia there are two criteria for evaluating relationships — XOR and sum. A subsegment of the path, containing some vertices lying on the path from region (x) to region (y), is called hospitable if it is non-empty and the sum of friendliness values on this subsegment does not exceed their XOR. More formally, for each query you are given two vertices (x) and (y) ((x \neq y)). Consider the shortest path from vertex (x) to vertex (y) in the tree. Let the vertices (v_1, v_2, \ldots, v_k) form this path, where (v_1 = x), (v_k = y). You need to find the number of subsegments of this path for which the following condition holds: () a_{v_{l}} \oplus a_{v_{l+1}} \oplus \ldots \oplus a_{v_{r}} \geq (a_{v_{l}} + a_{v_{l+1}} + \ldots + a_{v_{r}}), () where (1 \leq l \leq r \leq k) — the boundaries of the subsegment of vertices on the path from (x) to (y). Each test consists of multiple test cases. The first line contains a single integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains integers (n) ((2 \leq n \leq 10^5)) — the number of vertices in the tree, and (q) ((1 \leq q \leq 10^5)) — the number of queries. The second line contains an array of (n) non-negative integers — the friendliness values of the regions ((0 \leq a_i \lt 2^{20})). The next (n - 1) lines describe the edges of the tree: each line contains integers (u, v) ((1 \leq u, v \leq n))

Tutorials

154496

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
378518626 ankushlamror6376 G June 13, 2026, 1:35 p.m. OK C++17 (GCC 7-32) TESTS 34 437 16588800
378473671 TheGraven G June 13, 2026, 5:42 a.m. OK C++17 (GCC 7-32) TESTS 34 578 33075200
378553828 Basil815 G June 13, 2026, 7:49 p.m. OK C++17 (GCC 7-32) TESTS 34 1000 242585600
378498958 nwtk G June 13, 2026, 10:21 a.m. OK C++17 (GCC 7-32) TESTS 34 1125 181760000
378529869 Ziux_07 G June 13, 2026, 3:26 p.m. OK C++17 (GCC 7-32) TESTS 34 2046 49561600
378457211 ana.pacheco.loayzza G June 12, 2026, 10:52 p.m. OK C++17 (GCC 7-32) TESTS 34 2125 41164800
378547121 Hulkvision G June 13, 2026, 6:17 p.m. OK C++20 (GCC 13-64) TESTS 34 640 30310400
378456993 Lapoux G June 12, 2026, 10:42 p.m. OK C++20 (GCC 13-64) TESTS 34 640 51814400
378526029 gopal.thecoder G June 13, 2026, 2:49 p.m. OK C++20 (GCC 13-64) TESTS 34 734 21094400
378464271 ramumali2002 G June 13, 2026, 3:06 a.m. OK C++20 (GCC 13-64) TESTS 34 734 21094400
378507380 AlRntn G June 13, 2026, 11:41 a.m. OK C++20 (GCC 13-64) TESTS 34 781 67072000
378458663 late_night_dreams G June 13, 2026, 12:03 a.m. OK C++20 (GCC 13-64) TESTS 34 1031 52019200
378489057 noya2 G June 13, 2026, 8:51 a.m. OK C++20 (GCC 13-64) TESTS 34 1343 201011200
378552524 Makise.Kurisu G June 13, 2026, 7:28 p.m. OK C++20 (GCC 13-64) TESTS 34 1453 349491200
378452061 thisislike_fan G June 12, 2026, 8:19 p.m. OK C++20 (GCC 13-64) TESTS 34 1781 521523200
378570630 dou_ji_ G June 14, 2026, 4:40 a.m. OK C++20 (GCC 13-64) TESTS 35 2156 55910400
378518960 thisislike G June 13, 2026, 1:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 343 75878400
378532106 hawk.chan G June 13, 2026, 3:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 406 41267200
378503578 Salmon2653 G June 13, 2026, 11:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 453 28672000
378545782 4M49_H3R3 G June 13, 2026, 6:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 484 33894400
378501232 Optiver_2024 G June 13, 2026, 10:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 546 35020800
378538414 golomb G June 13, 2026, 4:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 578 44953600
378537490 naig G June 13, 2026, 4:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 625 45056000
378533640 hawk.chan G June 13, 2026, 4:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 671 20787200
378454088 redscar2907 G June 12, 2026, 9:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 718 91545600
378555524 ReaperScythe21 G June 13, 2026, 8:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 734 60313600
378478336 Ghost_tf141 G June 13, 2026, 6:41 a.m. OK GNU C11 TESTS 34 1890 260198400
378451959 hg_2005 G June 12, 2026, 8:17 p.m. OK Java 21 TESTS 34 984 53555200
378560172 dzhi G June 13, 2026, 10:47 p.m. OK Java 21 TESTS 35 1828 72499200
378560189 dzhi G June 13, 2026, 10:47 p.m. OK Java 21 TESTS 35 1843 73932800
378560215 dzhi G June 13, 2026, 10:49 p.m. OK Java 21 TESTS 35 1890 71782400
378560105 dzhi G June 13, 2026, 10:43 p.m. OK Java 21 TESTS 35 2265 71782400

remove filters

Back to search problems