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
There is the following puzzle popular among nuclear physicists. A reactor contains a set of n atoms of some chemical elements. We shall understand the phrase "atomic number" as the number of this atom's element in the periodic table of the chemical elements. You are allowed to take any two different atoms and fuse a new one from them. That results in a new atom, whose number is equal to the sum of the numbers of original atoms. The fusion operation can be performed several times. The aim is getting a new pregiven set of k atoms. The puzzle's difficulty is that it is only allowed to fuse two atoms into one, it is not allowed to split an atom into several atoms. You are suggested to try to solve the puzzle. The first line contains two integers n and k ( 1 ≤ k ≤ n ≤ 17 ). The second line contains space-separated symbols of elements of n atoms, which are available from the start. The third line contains space-separated symbols of elements of k atoms which need to be the result of the fusion. The symbols of the elements coincide with the symbols from the periodic table of the chemical elements. The atomic numbers do not exceed 100 (elements possessing larger numbers are highly unstable). Some atoms can have identical numbers (that is, there can be several atoms of the same element). The sum of numbers of initial atoms is equal to the sum of numbers of the atoms that need to be synthesized. If it is impossible to synthesize the required atoms, print " NO " without the quotes. Otherwise, print on the first line « YES », and on the next k lines print the way of synthesizing each of k atoms as equations. Each equation has the following form: " x 1 + x 2 + ... + x t -> y i ", where x j is the symbol of the element of some atom from the original set, and y i is the symbol of the element of some atom from the resulting set. Each atom from the input data should occur in the output data exactly one time. The order of summands in the equations, as well as the output orde |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
60238423 |
rainboy |
E |
Sept. 7, 2019, 7:41 p.m. |
OK |
GNU C11 |
TESTS |
93 |
108 |
1536000 |
|
2200 |
|
57905858 |
lopare |
E |
July 28, 2019, 5:35 p.m. |
OK |
GNU C++11 |
TESTS |
93 |
31 |
0 |
|
2200 |
|
64562854 |
dog_yang |
E |
Nov. 9, 2019, 6:40 a.m. |
OK |
GNU C++11 |
TESTS |
93 |
31 |
0 |
|
2200 |
|
68742293 |
zhangpuyang |
E |
Jan. 14, 2020, 2:08 a.m. |
OK |
GNU C++11 |
TESTS |
93 |
31 |
14745600 |
|
2200 |
|
63895195 |
lx_zjk |
E |
Oct. 31, 2019, 1:23 a.m. |
OK |
GNU C++11 |
TESTS |
93 |
124 |
53657600 |
|
2200 |
|
60068026 |
hey_boris |
E |
Sept. 5, 2019, 9:58 a.m. |
OK |
GNU C++11 |
TESTS |
93 |
171 |
1638400 |
|
2200 |
|
64524511 |
w_57 |
E |
Nov. 8, 2019, 1:21 p.m. |
OK |
GNU C++11 |
TESTS |
93 |
171 |
1638400 |
|
2200 |
|
58190525 |
BlueDiamond |
E |
Aug. 2, 2019, 7:20 p.m. |
OK |
GNU C++11 |
TESTS |
93 |
202 |
1638400 |
|
2200 |
|
63621629 |
gn_wz |
E |
Oct. 27, 2019, 11:41 p.m. |
OK |
GNU C++11 |
TESTS |
93 |
202 |
3174400 |
|
2200 |
|
64558421 |
dog_yang |
E |
Nov. 9, 2019, 5:02 a.m. |
OK |
GNU C++11 |
TESTS |
93 |
421 |
18329600 |
|
2200 |
|
64562260 |
dog_yang |
E |
Nov. 9, 2019, 6:27 a.m. |
OK |
GNU C++11 |
TESTS |
93 |
421 |
18329600 |
|
2200 |
|
56016547 |
sorry_im_smurfing |
E |
June 24, 2019, 9:44 p.m. |
OK |
GNU C++14 |
TESTS |
93 |
31 |
102400 |
|
2200 |
|
57812557 |
aapc_image |
E |
July 26, 2019, 6:03 p.m. |
OK |
GNU C++14 |
TESTS |
93 |
124 |
29286400 |
|
2200 |
|
53481237 |
smokescreen |
E |
April 28, 2019, 8:12 p.m. |
OK |
GNU C++14 |
TESTS |
93 |
140 |
4096000 |
|
2200 |
|
60194063 |
rtilikay |
E |
Sept. 7, 2019, midnight |
OK |
GNU C++14 |
TESTS |
93 |
202 |
1024000 |
|
2200 |
|
62327421 |
tate |
E |
Oct. 10, 2019, 7:06 p.m. |
OK |
GNU C++14 |
TESTS |
93 |
202 |
12595200 |
|
2200 |
|
63194957 |
arnavvats |
E |
Oct. 22, 2019, 6:17 p.m. |
OK |
GNU C++14 |
TESTS |
93 |
390 |
1740800 |
|
2200 |
|
64165804 |
Mai-sanBestWaifu |
E |
Nov. 3, 2019, 4:13 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
31 |
204800 |
|
2200 |
|
56059528 |
misir |
E |
June 26, 2019, 4:16 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
31 |
204800 |
|
2200 |
|
55931552 |
mlyean |
E |
June 22, 2019, 11:44 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
140 |
1740800 |
|
2200 |
|
67158271 |
Phortox |
E |
Dec. 18, 2019, 1:10 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
140 |
1740800 |
|
2200 |
|
54975946 |
kenimo |
E |
June 2, 2019, 10:49 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
140 |
10649600 |
|
2200 |
|
64501848 |
fzanutto |
E |
Nov. 8, 2019, 4:44 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
171 |
3276800 |
|
2200 |
|
55695198 |
ArshiaDadras |
E |
June 17, 2019, 9:08 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
187 |
2252800 |
|
2200 |
|
64914672 |
vjudge2 |
E |
Nov. 15, 2019, 3:08 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
187 |
13824000 |
|
2200 |
|
64914648 |
3liAckerman |
E |
Nov. 15, 2019, 3:07 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
202 |
13824000 |
|
2200 |
|
55590067 |
_Sakib_ |
E |
June 15, 2019, 11:50 a.m. |
OK |
GNU C++17 |
TESTS |
93 |
218 |
2252800 |
|
2200 |
|
60238424 |
Dukkha |
E |
Sept. 7, 2019, 7:41 p.m. |
OK |
Java 8 |
TESTS |
93 |
296 |
0 |
|
2200 |
|
57758223 |
mhorst |
E |
July 25, 2019, 5:01 p.m. |
OK |
Python 3 |
TESTS |
93 |
935 |
307200 |
|
2200 |
remove filters
Back to search problems