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"You are given a simple undirected graph with n vertices, n is even. You are going to write a letter on each vertex. Each letter should be one of the first k letters of the Latin alphabet. A path in the graph is called Hamiltonian if it visits each vertex exactly once. A string is called palindromic if it reads the same from left to right and from right to left. A path in the graph is called palindromic if the letters on the vertices in it spell a palindromic string without changing the order. A string of length n is good if: Note that the path doesn't necesserily go through the vertices in order 1, 2, ... , n . Count the number of good strings. The first line contains three integers n , m and k ( 2 <= n <= 12 ; n is even; 0 <= m <= frac{n cdot (n-1)}{2} ; 1 <= k <= 12 ) -- the number of vertices in the graph, the number of edges in the graph and the number of first letters of the Latin alphabet that can be used. Each of the next m lines contains two integers v and u ( 1 <= v, u <= n ; v neq u ) -- the edges of the graph. The graph doesn't contain multiple edges and self-loops. Print a single integer -- number of good strings. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
128308055 |
_ztyqwq |
F |
Sept. 9, 2021, 3:22 a.m. |
OK |
GNU C++14 |
TESTS |
103 |
561 |
10035200 |
|
|
128308157 |
_ztyqwq |
F |
Sept. 9, 2021, 3:24 a.m. |
OK |
GNU C++14 |
TESTS |
103 |
608 |
10035200 |
|
|
128306784 |
beginend |
F |
Sept. 9, 2021, 2:52 a.m. |
OK |
GNU C++14 |
TESTS |
103 |
1248 |
30617600 |
|
|
remove filters
Back to search problems