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.
Problems
B"Guy-Manuel and Thomas are planning 144 trips around the world. You are given a simple weighted undirected connected graph with n vertexes and m edges with the following restriction: there isn't any simple cycle (i. e. a cycle which doesn't pass through any vertex more than once) of length greater than 3 which passes through the vertex 1 . The cost of a path (not necessarily simple) in this graph is defined as the XOR of weights of all edges in that path with each edge being counted as many times as the path passes through it. But the trips with cost 0 aren't exciting. You may choose any subset of edges incident to the vertex 1 and remove them. How many are there such subsets, that, when removed, there is not any nontrivial cycle with the cost equal to 0 which passes through the vertex 1 in the resulting graph? A cycle is called nontrivial if it passes through some edge odd number of times. As the answer can be very big, output it modulo 10^9+7 . The first line contains two integers n and m ( 1 <= n,m <= 10^5 ) -- the number of vertexes and edges in the graph. The i -th of the next m lines contains three integers a_i , b_i and w_i ( 1 <= a_i, b_i <= n, a_i neq b_i, 0 <= w_i < 32 ) -- the endpoints of the i -th edge and its weight. It's guaranteed there aren't any multiple edges, the graph is connected and there isn't any simple cycle of length greater than 3 which passes through the vertex 1 . Output the answer modulo 10^9+7 . The pictures below represent the graphs from examples. In the first example, there aren't any nontrivial cycles with cost 0 , so we can either remove or keep the only edge incident to the vertex 1 . In the second example, if we don't remove the edge 1-2 , then there is a cycle 1-2-4-5-2-1 with cost 0 ; also if we don't remove the edge 1-3 , then there is a cycle 1"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
70664324 |
hos.lyric |
D |
Feb. 9, 2020, 3:18 p.m. |
OK |
D |
TESTS |
64 |
1123 |
98816000 |
|
2900 |
70841215 |
Fuyuki |
D |
Feb. 12, 2020, 12:03 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
124 |
173158400 |
|
2900 |
70708867 |
TiwAirOAO |
D |
Feb. 10, 2020, 6:16 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
155 |
7884800 |
|
2900 |
70682214 |
stal_xy23z7b8 |
D |
Feb. 9, 2020, 5:16 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
155 |
159334400 |
|
2900 |
70776626 |
gay__cjioer |
D |
Feb. 11, 2020, 9:07 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
156 |
4096000 |
|
2900 |
70838922 |
Fuyuki |
D |
Feb. 12, 2020, 11:14 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
171 |
173056000 |
|
2900 |
70736999 |
cjy2003 |
D |
Feb. 10, 2020, 2:56 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
186 |
4403200 |
|
2900 |
70665737 |
ohweonfire |
D |
Feb. 9, 2020, 3:22 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
187 |
4915200 |
|
2900 |
70669001 |
zx2003 |
D |
Feb. 9, 2020, 3:33 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
187 |
13619200 |
|
2900 |
70698293 |
Kongweijia |
D |
Feb. 10, 2020, 12:56 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
202 |
7475200 |
|
2900 |
70677121 |
djq_cpp |
D |
Feb. 9, 2020, 3:59 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
202 |
7884800 |
|
2900 |
70669128 |
yhx-12243 |
D |
Feb. 9, 2020, 3:33 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
140 |
9932800 |
|
2900 |
70787135 |
ruogu |
D |
Feb. 11, 2020, 12:42 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
155 |
8192000 |
|
2900 |
70701878 |
Cyanic |
D |
Feb. 10, 2020, 3:11 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
155 |
13619200 |
|
2900 |
70784045 |
Purple_wzy |
D |
Feb. 11, 2020, 11:44 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
156 |
183091200 |
|
2900 |
70715583 |
860579 |
D |
Feb. 10, 2020, 8:25 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
171 |
17408000 |
|
2900 |
70820406 |
jakedavis |
D |
Feb. 12, 2020, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
171 |
25702400 |
|
2900 |
70681711 |
PinkRabbit |
D |
Feb. 9, 2020, 5:12 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
202 |
60211200 |
|
2900 |
70702882 |
zhouzhendong |
D |
Feb. 10, 2020, 3:43 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
218 |
5836800 |
|
2900 |
70668591 |
Chelly |
D |
Feb. 9, 2020, 3:31 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
218 |
198348800 |
|
2900 |
70849102 |
ktrehear |
D |
Feb. 12, 2020, 2:21 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
234 |
8908800 |
|
2900 |
70932381 |
gongsuidashen |
D |
Feb. 13, 2020, 5:35 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
5939200 |
|
2900 |
70918471 |
little_misfortune |
D |
Feb. 12, 2020, 8:49 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
5939200 |
|
2900 |
70835195 |
little_misfortune |
D |
Feb. 12, 2020, 9:53 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
5939200 |
|
2900 |
70701081 |
neal |
D |
Feb. 10, 2020, 2:44 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
77 |
5734400 |
|
2900 |
70701065 |
neal |
D |
Feb. 10, 2020, 2:43 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
77 |
5734400 |
|
2900 |
70701090 |
neal |
D |
Feb. 10, 2020, 2:44 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
78 |
5632000 |
|
2900 |
70834426 |
little_misfortune |
D |
Feb. 12, 2020, 9:37 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
93 |
5939200 |
|
2900 |
70918411 |
little_misfortune |
D |
Feb. 12, 2020, 8:47 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
108 |
5939200 |
|
2900 |
70700908 |
neal |
D |
Feb. 10, 2020, 2:37 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
109 |
5632000 |
|
2900 |
70700640 |
neal |
D |
Feb. 10, 2020, 2:28 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
139 |
5632000 |
|
2900 |
70765849 |
Suzukaze |
D |
Feb. 11, 2020, 4:43 a.m. |
OK |
Java 11 |
TESTS |
64 |
826 |
22835200 |
|
2900 |
70695113 |
sansen |
D |
Feb. 9, 2020, 9:57 p.m. |
OK |
Rust |
TESTS |
64 |
888 |
10137600 |
|
2900 |
70695027 |
sansen |
D |
Feb. 9, 2020, 9:54 p.m. |
OK |
Rust |
TESTS |
64 |
1981 |
10137600 |
|
2900 |
remove filters
Back to search problems