Codeforces Round 851 (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
1788 Codeforces Round 851 (Div. 2) FINISHED False 7200 61226663 Feb. 9, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 889 ) F XOR, Tree, and Queries PROGRAMMING constructive algorithms dfs and similar ds graphs trees

B'You are given a tree of n vertices. The vertices are numbered from 1 to n . You will need to assign a weight to each edge. Let the weight of the i -th edge be a_i ( 1 <= q i <= q n-1 ). The weight of each edge should be an integer between 0 and 2^{30}-1 , inclusive. You are given q conditions. Each condition consists of three integers u , v , and x . This means that the bitwise XOR of all edges on the shortest path from u to v should be x . Find out if there exist a_1, a_2, ldots, a_{n-1} that satisfy the given conditions. If yes, print a solution such that a_1 oplus a_2 oplus ldots oplus a_{n-1} is the smallest. Here, oplus denotes the bitwise XOR operation. If there are multiple solutions such that a_1 oplus a_2 oplus ldots oplus a_{n-1} is the smallest, print any. The first line contains two integers n and q ( 2 <= n <= 2.5 cdot 10^5 , 0 <= q <= 2.5 cdot 10^5 ). The i -th of the following n-1 lines contains two integers x_i and y_i ( 1 <= x_i, y_i <= n , x_i neq y_i ), meaning that the i -th edge connects vertices x_i and y_i in the tree. It is guaranteed that the given edges form a tree. The following q lines contain information about conditions. Each line contains three integers u , v , x ( 1 <= u, v <= n , u neq v , 0 <= x <= 2^{30}-1 ), meaning that the bitwise XOR of all edges on the shortest path from u to v should be x . If there do not exist a_1 , a_2 , ..., a_{n-1} that satisfy the given conditions, print "No". Otherwise, print "Yes" in the first line. Then print n-1 integers on the next line, where the i -th integer is the weight of the i -th edge. If there are multiple solutions that satisfy the given conditions, print a solution such that a_1 oplus a_2 oplus'...

Tutorials

Codeforces Round #851 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
192999815 572txdy F Feb. 9, 2023, 11:59 p.m. OK GNU C++14 TESTS 114 389 14950400
193019818 luogu_bot1 F Feb. 10, 2023, 5:52 a.m. OK GNU C++14 TESTS 114 389 24064000
193009017 YeahPotato F Feb. 10, 2023, 3:26 a.m. OK GNU C++14 TESTS 114 436 8396800
192997190 Mobius_127 F Feb. 9, 2023, 10:49 p.m. OK GNU C++14 TESTS 114 436 24064000
193012429 LXH-cat F Feb. 10, 2023, 4:20 a.m. OK GNU C++14 TESTS 114 452 19353600
193010775 william556 F Feb. 10, 2023, 3:55 a.m. OK GNU C++14 TESTS 114 467 16384000
193000099 Feynn F Feb. 10, 2023, 12:06 a.m. OK GNU C++14 TESTS 114 608 33382400
193004734 Feynn F Feb. 10, 2023, 2:09 a.m. OK GNU C++14 TESTS 114 623 33382400
193004428 czyer F Feb. 10, 2023, 2:02 a.m. OK GNU C++14 TESTS 114 717 44441600
193004921 OccDreamer F Feb. 10, 2023, 2:13 a.m. OK GNU C++14 TESTS 114 795 35942400
192981406 Kahou F Feb. 9, 2023, 7:10 p.m. OK GNU C++17 TESTS 114 420 16076800
192995682 Ant_Man F Feb. 9, 2023, 10:18 p.m. OK GNU C++17 TESTS 114 420 24473600
192969366 nachotang F Feb. 9, 2023, 5:36 p.m. OK GNU C++17 TESTS 114 468 29286400
192993596 regain0001 F Feb. 9, 2023, 9:41 p.m. OK GNU C++17 TESTS 114 483 18841600
192974842 DaiRuiChen00007 F Feb. 9, 2023, 6:14 p.m. OK GNU C++17 TESTS 114 498 23040000
192965981 El3ageed_Abu_Shehab F Feb. 9, 2023, 5:19 p.m. OK GNU C++17 TESTS 114 498 26624000
193004664 shhy287029 F Feb. 10, 2023, 2:07 a.m. OK GNU C++17 TESTS 114 514 18841600
192997972 ocarima F Feb. 9, 2023, 11:07 p.m. OK GNU C++17 TESTS 114 592 49254400
193019236 Dominater069 F Feb. 10, 2023, 5:45 a.m. OK GNU C++17 TESTS 114 608 49356800
192966390 hibye1217 F Feb. 9, 2023, 5:21 p.m. OK GNU C++17 TESTS 114 623 40755200
192988979 thomas_li F Feb. 9, 2023, 8:32 p.m. OK GNU C++17 (64) TESTS 114 436 22835200
193002284 Superposition F Feb. 10, 2023, 1:06 a.m. OK GNU C++17 (64) TESTS 114 436 52224000
192981686 Anshul_yd F Feb. 9, 2023, 7:13 p.m. OK GNU C++17 (64) TESTS 114 452 22425600
193004465 liqingyang F Feb. 10, 2023, 2:03 a.m. OK GNU C++17 (64) TESTS 114 452 34201600
193002305 Superposition F Feb. 10, 2023, 1:07 a.m. OK GNU C++17 (64) TESTS 114 452 52224000
192967777 syzf2222 F Feb. 9, 2023, 5:27 p.m. OK GNU C++17 (64) TESTS 114 483 16076800
193012135 Ethan_xu F Feb. 10, 2023, 4:15 a.m. OK GNU C++17 (64) TESTS 114 483 54067200
193009713 MtSaka F Feb. 10, 2023, 3:37 a.m. OK GNU C++17 (64) TESTS 114 545 54374400
192965102 nathanlee726 F Feb. 9, 2023, 5:17 p.m. OK GNU C++17 (64) TESTS 114 561 64512000
193003935 zhangboju F Feb. 10, 2023, 1:51 a.m. OK GNU C++17 (64) TESTS 114 577 42291200
192981560 leaf1415 F Feb. 9, 2023, 7:11 p.m. OK GNU C++20 (64) TESTS 114 218 29491200
192974921 -1e11 F Feb. 9, 2023, 6:14 p.m. OK GNU C++20 (64) TESTS 114 311 28160000
193001659 GimmyJR F Feb. 10, 2023, 12:50 a.m. OK GNU C++20 (64) TESTS 114 326 22528000
192995416 -kirito- F Feb. 9, 2023, 10:13 p.m. OK GNU C++20 (64) TESTS 114 342 36147200
193005471 yingluosanqian F Feb. 10, 2023, 2:24 a.m. OK GNU C++20 (64) TESTS 114 343 22425600
192965455 Turkhuuu F Feb. 9, 2023, 5:18 p.m. OK GNU C++20 (64) TESTS 114 358 22425600
193002273 blockche F Feb. 10, 2023, 1:06 a.m. OK GNU C++20 (64) TESTS 114 358 22528000
193004618 A_G F Feb. 10, 2023, 2:06 a.m. OK GNU C++20 (64) TESTS 114 358 35532800
192985465 Ivan_len F Feb. 9, 2023, 7:50 p.m. OK GNU C++20 (64) TESTS 114 358 47206400
192991501 gongkoufadongji F Feb. 9, 2023, 9:07 p.m. OK GNU C++20 (64) TESTS 114 373 45363200
193019249 DylanSmith F Feb. 10, 2023, 5:45 a.m. OK Java 8 TESTS 114 2261 151347200
192974238 misorin F Feb. 9, 2023, 6:09 p.m. OK PyPy 3 TESTS 114 748 55910400
192983378 FAROUK_IDHEMMOU F Feb. 9, 2023, 7:29 p.m. OK Python 3 TESTS 114 2605 70758400

remove filters

Back to search problems