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'Another feature of Shakespeare language is that the variables are named after characters of plays by Shakespeare, and all operations on them (value assignment, output etc.) look like a dialog with other characters. New values of variables are defined in a rather lengthy way, so a programmer should try to minimize their usage. You have to print the given sequence of n integers. To do this, you have m variables and two types of operations on them: Any of the m variables can be used as variable. Variables are denoted by lowercase letters between "a" and "z", inclusive. Any integer number can be used as integer. Let 's say that the penalty for using first type of operations equals to the number of set bits in the number integer. There is no penalty on using second type of operations. Find and output the program which minimizes the penalty for printing the given sequence of numbers. The first line of input contains integers n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89250, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8926). The second line contains the sequence to be printed. Each element of the sequence is an integer between 1 and 109, inclusive. The sequence has to be printed in the given order (from left to right). Output the number of lines in the optimal program and the optimal penalty. Next, output the program itself, one command per line. If there are several programs with minimal penalty, output any of them (you have only to minimize the penalty).'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
2876806 |
coolinging |
E |
Jan. 6, 2013, 6:14 a.m. |
OK |
FPC |
TESTS |
57 |
62 |
1638400 |
|
2600 |
1045323 |
coolinging |
E |
Jan. 14, 2012, 2:17 p.m. |
OK |
FPC |
TESTS |
57 |
80 |
2662400 |
|
2600 |
930656 |
coolinging |
E |
Dec. 5, 2011, 6:39 a.m. |
OK |
FPC |
TESTS |
57 |
80 |
2662400 |
|
2600 |
1354668 |
sillycross |
E |
March 13, 2012, 12:11 p.m. |
OK |
FPC |
TESTS |
57 |
90 |
122777600 |
|
2600 |
930676 |
coolinging |
E |
Dec. 5, 2011, 7:05 a.m. |
OK |
FPC |
TESTS |
57 |
110 |
2662400 |
|
2600 |
2794031 |
luogan |
E |
Dec. 19, 2012, 9:58 a.m. |
OK |
FPC |
TESTS |
57 |
156 |
409600 |
|
2600 |
935693 |
suanrong |
E |
Dec. 8, 2011, 1:54 p.m. |
OK |
FPC |
TESTS |
57 |
200 |
2867200 |
|
2600 |
1312339 |
object022 |
E |
March 8, 2012, 2:03 p.m. |
OK |
FPC |
TESTS |
57 |
200 |
23244800 |
|
2600 |
930503 |
zanoes |
E |
Dec. 5, 2011, 3:27 a.m. |
OK |
FPC |
TESTS |
57 |
220 |
6758400 |
|
2600 |
1354091 |
vjudge2 |
E |
March 13, 2012, 7:49 a.m. |
OK |
FPC |
TESTS |
57 |
220 |
122777600 |
|
2600 |
2857046 |
hogloid |
E |
Dec. 30, 2012, 1:17 p.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
102400 |
|
2600 |
3620761 |
nardy |
E |
April 25, 2013, 1:45 p.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
6451200 |
|
2600 |
2904088 |
dhh1995 |
E |
Jan. 11, 2013, 6:07 a.m. |
OK |
GNU C++ |
TESTS |
57 |
15 |
6451200 |
|
2600 |
930650 |
self_healing |
E |
Dec. 5, 2011, 6:29 a.m. |
OK |
GNU C++ |
TESTS |
57 |
30 |
5734400 |
|
2600 |
20959091 |
ShinFeb |
E |
Sept. 28, 2016, 2:52 a.m. |
OK |
GNU C++ |
TESTS |
57 |
30 |
8192000 |
|
2600 |
4239418 |
CaliburianC.C. |
E |
Aug. 7, 2013, 7:57 a.m. |
OK |
GNU C++ |
TESTS |
57 |
30 |
14233600 |
|
2600 |
2953670 |
ChuckLin2014 |
E |
Jan. 17, 2013, 4:35 p.m. |
OK |
GNU C++ |
TESTS |
57 |
31 |
102400 |
|
2600 |
2670944 |
chenwenxiao |
E |
Nov. 28, 2012, 2:04 a.m. |
OK |
GNU C++ |
TESTS |
57 |
31 |
1740800 |
|
2600 |
3785793 |
dogcpp |
E |
May 28, 2013, 1:01 a.m. |
OK |
GNU C++ |
TESTS |
57 |
31 |
3686400 |
|
2600 |
2880030 |
dogcpp |
E |
Jan. 7, 2013, 8:26 a.m. |
OK |
GNU C++ |
TESTS |
57 |
31 |
3686400 |
|
2600 |
2610034 |
roosephu |
E |
Nov. 21, 2012, 11:44 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
31 |
102400 |
|
2600 |
2910773 |
xlk |
E |
Jan. 13, 2013, 10:33 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
31 |
6144000 |
|
2600 |
2828159 |
CMHJT |
E |
Dec. 26, 2012, 8:15 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
62 |
307200 |
|
2600 |
986762 |
Archon.JK |
E |
Dec. 26, 2011, 9 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
80 |
3174400 |
|
2600 |
2825821 |
bakabakashyoshyo |
E |
Dec. 25, 2012, 1:45 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
109 |
2048000 |
|
2600 |
8290357 |
I_love_Hoang_Yen |
E |
Oct. 18, 2014, 7:03 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
154 |
3584000 |
|
2600 |
2795207 |
sayade |
E |
Dec. 19, 2012, 3:21 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
171 |
2969600 |
|
2600 |
2746328 |
dc. |
E |
Dec. 10, 2012, 8:35 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
203 |
17612800 |
|
2600 |
9769946 |
YakutovDmitriy |
E |
Feb. 8, 2015, 9:53 a.m. |
OK |
GNU C++0x |
TESTS |
57 |
280 |
2867200 |
|
2600 |
9425569 |
sdya |
E |
Jan. 13, 2015, 7:07 p.m. |
OK |
GNU C++0x |
TESTS |
57 |
372 |
5120000 |
|
2600 |
21329361 |
MohanLau |
E |
Oct. 10, 2016, 2:46 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
2252800 |
|
2600 |
23610544 |
ericxu0 |
E |
Jan. 6, 2017, 6:41 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
30 |
2867200 |
|
2600 |
51819174 |
zbtrs |
E |
March 25, 2019, 11:08 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
204800 |
|
2600 |
27893820 |
I_always_love_cc |
E |
June 19, 2017, 2:06 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
409600 |
|
2600 |
31767440 |
leaomatheus |
E |
Oct. 26, 2017, 5:41 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
614400 |
|
2600 |
14760271 |
infiniteloop17 |
E |
Dec. 11, 2015, 3:36 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
819200 |
|
2600 |
14760214 |
infiniteloop17 |
E |
Dec. 11, 2015, 3:33 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
819200 |
|
2600 |
51367529 |
luogu_bot2 |
E |
March 16, 2019, 10:24 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
2355200 |
|
2600 |
57903377 |
lopare |
E |
July 28, 2019, 4:36 p.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
6348800 |
|
2600 |
52769083 |
xielinhan |
E |
April 15, 2019, 7:13 a.m. |
OK |
GNU C++11 |
TESTS |
57 |
62 |
6348800 |
|
2600 |
26137928 |
doubility |
E |
April 5, 2017, 7:48 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
62 |
6144000 |
|
2600 |
61711231 |
MinecraftFuns |
E |
Oct. 2, 2019, 11:29 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
62 |
6553600 |
|
2600 |
67438938 |
Fazle |
E |
Dec. 22, 2019, 6:24 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
409600 |
|
2600 |
35958271 |
wfj_2048 |
E |
March 5, 2018, 7:27 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
4096000 |
|
2600 |
56023840 |
sorry_im_smurfing |
E |
June 25, 2019, 5:51 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
6451200 |
|
2600 |
51362293 |
huyufeifei |
E |
March 16, 2019, 7:54 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
92 |
16076800 |
|
2600 |
23277047 |
aditya1495 |
E |
Dec. 24, 2016, 5:53 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
122 |
4403200 |
|
2600 |
67195922 |
ElangBondol |
E |
Dec. 19, 2019, 9:02 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
124 |
921600 |
|
2600 |
23277247 |
aditya1495 |
E |
Dec. 24, 2016, 6:07 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
156 |
4505600 |
|
2600 |
34406122 |
Cyanic |
E |
Jan. 21, 2018, 8:32 a.m. |
OK |
GNU C++14 |
TESTS |
57 |
156 |
14336000 |
|
2600 |
39013328 |
majk |
E |
June 7, 2018, 8:46 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
614400 |
|
2600 |
62450918 |
hjk1030 |
E |
Oct. 13, 2019, 4:03 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
62 |
1638400 |
|
2600 |
48566611 |
.I. |
E |
Jan. 19, 2019, 9:55 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
122 |
614400 |
|
2600 |
58091681 |
cerberus97 |
E |
July 31, 2019, 5:49 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
156 |
2662400 |
|
2600 |
64790243 |
cristian1997 |
E |
Nov. 13, 2019, 10:54 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
216 |
3379200 |
|
2600 |
67525981 |
Martin53 |
E |
Dec. 24, 2019, 2:02 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
248 |
2355200 |
|
2600 |
46008426 |
dthangnguyen19 |
E |
Nov. 20, 2018, 6:28 p.m. |
OK |
GNU C++17 |
TESTS |
57 |
248 |
22732800 |
|
2600 |
49857017 |
_Happy_New_Year_ |
E |
Feb. 13, 2019, 7:43 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
310 |
2150400 |
|
2600 |
41925123 |
ruo |
E |
Aug. 21, 2018, 7:05 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
716 |
1638400 |
|
2600 |
48166084 |
ivan100sic |
E |
Jan. 10, 2019, 1:24 a.m. |
OK |
GNU C++17 |
TESTS |
57 |
902 |
10752000 |
|
2600 |
927176 |
OgieKako |
E |
Dec. 3, 2011, 6:22 p.m. |
OK |
Java 6 |
TESTS |
57 |
160 |
43212800 |
|
2600 |
950913 |
uwi |
E |
Dec. 11, 2011, 5:06 a.m. |
OK |
Java 6 |
TESTS |
57 |
160 |
43622400 |
|
2600 |
951785 |
FattyPenguin |
E |
Dec. 11, 2011, 2:58 p.m. |
OK |
Java 6 |
TESTS |
57 |
200 |
43417600 |
|
2600 |
928762 |
YuukaKazami |
E |
Dec. 4, 2011, 6:11 a.m. |
OK |
Java 6 |
TESTS |
57 |
280 |
43417600 |
|
2600 |
956497 |
Di735 |
E |
Dec. 15, 2011, 1:24 p.m. |
OK |
Java 6 |
TESTS |
57 |
630 |
43417600 |
|
2600 |
928644 |
YuukaKazami |
E |
Dec. 4, 2011, 5:17 a.m. |
OK |
Java 6 |
TESTS |
57 |
980 |
43417600 |
|
2600 |
935961 |
Berestinsky |
E |
Dec. 8, 2011, 4:20 p.m. |
OK |
Java 6 |
TESTS |
57 |
1300 |
35635200 |
|
2600 |
16295510 |
sroyal |
E |
Feb. 23, 2016, 3:58 p.m. |
OK |
Java 7 |
TESTS |
57 |
964 |
0 |
|
2600 |
9092590 |
Slamur |
E |
Dec. 12, 2014, 3:36 p.m. |
OK |
Java 8 |
TESTS |
57 |
934 |
0 |
|
2600 |
9293995 |
AlexFetisov |
E |
Dec. 28, 2014, 7:50 p.m. |
OK |
Java 8 |
TESTS |
57 |
996 |
0 |
|
2600 |
9092088 |
Slamur |
E |
Dec. 12, 2014, 2:57 p.m. |
OK |
Java 8 |
TESTS |
57 |
1652 |
0 |
|
2600 |
9092134 |
Slamur |
E |
Dec. 12, 2014, 3:02 p.m. |
OK |
Java 8 |
TESTS |
57 |
1808 |
0 |
|
2600 |
929243 |
Usagi.K |
E |
Dec. 4, 2011, 10:42 a.m. |
OK |
MS C++ |
TESTS |
57 |
30 |
1433600 |
|
2600 |
927053 |
UESTC_Nocturne |
E |
Dec. 3, 2011, 6:17 p.m. |
OK |
MS C++ |
TESTS |
57 |
30 |
51916800 |
|
2600 |
928275 |
vitar |
E |
Dec. 4, 2011, 1:57 a.m. |
OK |
MS C++ |
TESTS |
57 |
60 |
11776000 |
|
2600 |
9487957 |
Milanin |
E |
Jan. 20, 2015, 8:43 p.m. |
OK |
MS C++ |
TESTS |
57 |
62 |
7270400 |
|
2600 |
936575 |
mongolrgata |
E |
Dec. 9, 2011, 5:16 a.m. |
OK |
MS C++ |
TESTS |
57 |
90 |
1740800 |
|
2600 |
928236 |
vitar |
E |
Dec. 4, 2011, 1:38 a.m. |
OK |
MS C++ |
TESTS |
57 |
140 |
12390400 |
|
2600 |
1767791 |
impetus |
E |
June 6, 2012, 2:56 p.m. |
OK |
MS C++ |
TESTS |
57 |
380 |
5529600 |
|
2600 |
7611540 |
danilka.pro |
E |
Aug. 28, 2014, 7:41 a.m. |
OK |
MS C++ |
TESTS |
57 |
1652 |
3174400 |
|
2600 |
67431700 |
oSD |
E |
Dec. 22, 2019, 3:26 p.m. |
OK |
MS C++ 2017 |
TESTS |
57 |
1434 |
7065600 |
|
2600 |
remove filters
Back to search problems