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"After several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity to earn money and changed their jobs to attract tourists. Petya, for example, left the IT corporation he had been working for and started to sell souvenirs at the market. This morning, as usual, Petya will come to the market. Petya has n different souvenirs to sell; ith souvenir is characterised by its weight wi and cost ci. Petya knows that he might not be able to carry all the souvenirs to the market. So Petya wants to choose a subset of souvenirs such that its total weight is not greater than m, and total cost is maximum possible. Help Petya to determine maximum possible total cost. The first line contains two integers n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89300000) -- the number of Petya's souvenirs and total weight that he can carry to the market. Then n lines follow. ith line contains two integers wi and ci (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89wi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the weight and the cost of ith souvenir. Print one number -- maximum possible total cost of souvenirs that Petya can carry to the market. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
27215235 |
FalseMirror |
E |
May 19, 2017, 1:20 p.m. |
OK |
D |
TESTS |
73 |
156 |
7270400 |
|
2300 |
27337103 |
vjudge2 |
E |
May 25, 2017, 12:59 p.m. |
OK |
FPC |
TESTS |
73 |
62 |
21606400 |
|
2300 |
27174539 |
xzyxzy |
E |
May 17, 2017, 7:39 a.m. |
OK |
GNU C++ |
TESTS |
73 |
30 |
3584000 |
|
2300 |
27154353 |
AkaneSasu |
E |
May 16, 2017, 8:31 a.m. |
OK |
GNU C++ |
TESTS |
73 |
30 |
11161600 |
|
2300 |
31146342 |
Steaunk |
E |
Oct. 8, 2017, 2:09 p.m. |
OK |
GNU C++ |
TESTS |
73 |
30 |
96051200 |
|
2300 |
31166885 |
R_rank_Pyramid |
E |
Oct. 9, 2017, 12:25 p.m. |
OK |
GNU C++ |
TESTS |
73 |
30 |
120115200 |
|
2300 |
32547418 |
Scut82 |
E |
Nov. 22, 2017, 10:57 a.m. |
OK |
GNU C++ |
TESTS |
73 |
31 |
4812800 |
|
2300 |
27603458 |
zqh_wz |
E |
June 6, 2017, 2:30 a.m. |
OK |
GNU C++ |
TESTS |
73 |
31 |
5632000 |
|
2300 |
27284187 |
XuYipei |
E |
May 22, 2017, 12:44 p.m. |
OK |
GNU C++ |
TESTS |
73 |
31 |
7270400 |
|
2300 |
27197713 |
love_master |
E |
May 18, 2017, 1:34 p.m. |
OK |
GNU C++ |
TESTS |
73 |
31 |
8601600 |
|
2300 |
27466419 |
cbhcbh |
E |
May 31, 2017, 12:24 p.m. |
OK |
GNU C++ |
TESTS |
73 |
31 |
8806400 |
|
2300 |
36501129 |
hl666 |
E |
March 22, 2018, 12:13 p.m. |
OK |
GNU C++ |
TESTS |
73 |
31 |
13004800 |
|
2300 |
27149389 |
shubhz |
E |
May 16, 2017, 3:46 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
15 |
3481600 |
|
2300 |
63825001 |
zrmpaul |
E |
Oct. 30, 2019, 1:22 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
2457600 |
|
2300 |
40980907 |
ReaLNero1 |
E |
July 30, 2018, 5:45 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
3481600 |
|
2300 |
27485927 |
yyf0309 |
E |
June 1, 2017, 1:47 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
9625600 |
|
2300 |
33302647 |
vjudge2 |
E |
Dec. 16, 2017, 12:45 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
11673600 |
|
2300 |
58105557 |
ModestCoder |
E |
Aug. 1, 2019, 4 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
14438400 |
|
2300 |
39220158 |
FangHao |
E |
June 13, 2018, 3:11 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
26521600 |
|
2300 |
27329527 |
150137 |
E |
May 25, 2017, 5:07 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
50790400 |
|
2300 |
52018687 |
Steaunk |
E |
March 30, 2019, 11:41 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
120115200 |
|
2300 |
58127572 |
vjudge5 |
E |
Aug. 1, 2019, 1:08 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
31 |
120217600 |
|
2300 |
27166312 |
LiChenKoh |
E |
May 16, 2017, 5:50 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
1638400 |
|
2300 |
27170355 |
BanFcc |
E |
May 17, 2017, 1 a.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
3993600 |
|
2300 |
55943819 |
Thanhxuanlahoitiec |
E |
June 22, 2019, 6:20 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
6041600 |
|
2300 |
27210377 |
drdanailov |
E |
May 19, 2017, 8:14 a.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
6041600 |
|
2300 |
27164404 |
zoomswk |
E |
May 16, 2017, 3:52 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
6041600 |
|
2300 |
27164395 |
zoomswk |
E |
May 16, 2017, 3:52 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
6041600 |
|
2300 |
27163046 |
sai |
E |
May 16, 2017, 2:44 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
6860800 |
|
2300 |
34185777 |
.I. |
E |
Jan. 14, 2018, 10:55 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
7270400 |
|
2300 |
27679116 |
Neroo |
E |
June 8, 2017, 9:25 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
8499200 |
|
2300 |
28256997 |
-Morass- |
E |
July 3, 2017, 1:38 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
46 |
12800000 |
|
2300 |
57323932 |
vjudge4 |
E |
July 19, 2019, 11:16 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
46 |
6041600 |
|
2300 |
57314415 |
vjudge5 |
E |
July 19, 2019, 7:42 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
61 |
3788800 |
|
2300 |
49051451 |
Ging_ |
E |
Jan. 27, 2019, 11:17 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
61 |
5529600 |
|
2300 |
63894795 |
KillerX |
E |
Oct. 31, 2019, 1:07 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
3788800 |
|
2300 |
55429364 |
gubeiqg |
E |
June 11, 2019, 10:37 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
3993600 |
|
2300 |
63769131 |
KillerX |
E |
Oct. 30, 2019, 7:19 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
5529600 |
|
2300 |
49050272 |
Ging_ |
E |
Jan. 27, 2019, 10:43 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
5529600 |
|
2300 |
65498343 |
KonaeAkira |
E |
Nov. 21, 2019, 5:35 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
6041600 |
|
2300 |
64422202 |
errorgorn |
E |
Nov. 6, 2019, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
6041600 |
|
2300 |
57323666 |
vjudge4 |
E |
July 19, 2019, 11:09 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
62 |
6041600 |
|
2300 |
27314317 |
fqw |
E |
May 24, 2017, 5:22 a.m. |
OK |
Haskell |
TESTS |
73 |
280 |
38195200 |
|
2300 |
27259322 |
RP_9 |
E |
May 21, 2017, 5:34 a.m. |
OK |
Java 8 |
TESTS |
73 |
155 |
5632000 |
|
2300 |
27201071 |
karpov |
E |
May 18, 2017, 4:47 p.m. |
OK |
Java 8 |
TESTS |
73 |
171 |
3379200 |
|
2300 |
28101798 |
xodiac |
E |
June 27, 2017, 6:35 p.m. |
OK |
Java 8 |
TESTS |
73 |
171 |
27955200 |
|
2300 |
27167809 |
shavkat |
E |
May 16, 2017, 7:37 p.m. |
OK |
Java 8 |
TESTS |
73 |
186 |
7680000 |
|
2300 |
27184476 |
AhmedSoliman |
E |
May 17, 2017, 5:29 p.m. |
OK |
Java 8 |
TESTS |
73 |
187 |
7782400 |
|
2300 |
27182381 |
di_halt |
E |
May 17, 2017, 3:05 p.m. |
OK |
Java 8 |
TESTS |
73 |
202 |
0 |
|
2300 |
27182373 |
di_halt |
E |
May 17, 2017, 3:04 p.m. |
OK |
Java 8 |
TESTS |
73 |
202 |
0 |
|
2300 |
27182350 |
di_halt |
E |
May 17, 2017, 3:03 p.m. |
OK |
Java 8 |
TESTS |
73 |
202 |
0 |
|
2300 |
27168035 |
Kammola |
E |
May 16, 2017, 7:56 p.m. |
OK |
Java 8 |
TESTS |
73 |
202 |
716800 |
|
2300 |
42274223 |
Taran_1407 |
E |
Aug. 30, 2018, 10:18 a.m. |
OK |
Java 8 |
TESTS |
73 |
233 |
0 |
|
2300 |
27185632 |
lionvs13 |
E |
May 17, 2017, 6:58 p.m. |
OK |
MS C# |
TESTS |
73 |
139 |
14028800 |
|
2300 |
27155721 |
artsin666 |
E |
May 16, 2017, 9:24 a.m. |
OK |
MS C# |
TESTS |
73 |
171 |
12595200 |
|
2300 |
27325293 |
flatline |
E |
May 24, 2017, 7:05 p.m. |
OK |
MS C# |
TESTS |
73 |
218 |
19763200 |
|
2300 |
55830835 |
vjudge5 |
E |
June 20, 2019, 1:03 p.m. |
OK |
MS C++ |
TESTS |
73 |
46 |
11059200 |
|
2300 |
36501092 |
hl666 |
E |
March 22, 2018, 12:12 p.m. |
OK |
MS C++ |
TESTS |
73 |
46 |
13209600 |
|
2300 |
36252362 |
vjudge5 |
E |
March 13, 2018, 2:31 p.m. |
OK |
MS C++ |
TESTS |
73 |
46 |
28467200 |
|
2300 |
36242423 |
ys1468362286 |
E |
March 13, 2018, 8:37 a.m. |
OK |
MS C++ |
TESTS |
73 |
46 |
28467200 |
|
2300 |
68085925 |
tarattata1 |
E |
Jan. 2, 2020, 4:14 p.m. |
OK |
MS C++ |
TESTS |
73 |
61 |
1740800 |
|
2300 |
58113285 |
vjudge2 |
E |
Aug. 1, 2019, 8:01 a.m. |
OK |
MS C++ |
TESTS |
73 |
62 |
7987200 |
|
2300 |
33963604 |
nomiku99 |
E |
Jan. 6, 2018, 1:32 p.m. |
OK |
MS C++ |
TESTS |
73 |
93 |
5427200 |
|
2300 |
27167949 |
redoak |
E |
May 16, 2017, 7:49 p.m. |
OK |
MS C++ |
TESTS |
73 |
109 |
3993600 |
|
2300 |
27187004 |
batya_322 |
E |
May 17, 2017, 9:15 p.m. |
OK |
MS C++ |
TESTS |
73 |
155 |
6144000 |
|
2300 |
55608867 |
vjudge2 |
E |
June 16, 2019, 3:52 a.m. |
OK |
MS C++ |
TESTS |
73 |
155 |
11264000 |
|
2300 |
58104639 |
vjudge5 |
E |
Aug. 1, 2019, 3:23 a.m. |
OK |
MS C++ 2017 |
TESTS |
73 |
124 |
3993600 |
|
2300 |
28021621 |
andreamaf |
E |
June 25, 2017, 11:54 a.m. |
OK |
PyPy 2 |
TESTS |
73 |
483 |
45465600 |
|
2300 |
68080119 |
auouo |
E |
Jan. 2, 2020, 2:03 p.m. |
OK |
PyPy 3 |
TESTS |
73 |
420 |
17408000 |
|
2300 |
54825325 |
artifexbm |
E |
May 30, 2019, 6:07 a.m. |
OK |
PyPy 3 |
TESTS |
73 |
1138 |
22220800 |
|
2300 |
27229225 |
12121005 |
E |
May 20, 2017, 6:26 a.m. |
OK |
Python 2 |
TESTS |
73 |
608 |
15667200 |
|
2300 |
27220992 |
jiezhou0731 |
E |
May 19, 2017, 7:18 p.m. |
OK |
Python 2 |
TESTS |
73 |
857 |
29081600 |
|
2300 |
27262417 |
Ostkaka |
E |
May 21, 2017, 8:16 a.m. |
OK |
Python 2 |
TESTS |
73 |
1747 |
53862400 |
|
2300 |
27262197 |
Ostkaka |
E |
May 21, 2017, 8:05 a.m. |
OK |
Python 2 |
TESTS |
73 |
1747 |
53862400 |
|
2300 |
27227163 |
orailly |
E |
May 20, 2017, 3:16 a.m. |
OK |
Python 3 |
TESTS |
73 |
436 |
9830400 |
|
2300 |
27222004 |
sas |
E |
May 19, 2017, 8:01 p.m. |
OK |
Python 3 |
TESTS |
73 |
623 |
5529600 |
|
2300 |
68476659 |
tomo0608 |
E |
Jan. 10, 2020, 5:55 a.m. |
OK |
Python 3 |
TESTS |
73 |
623 |
7680000 |
|
2300 |
27169366 |
nanae1914 |
E |
May 16, 2017, 10:19 p.m. |
OK |
Python 3 |
TESTS |
73 |
623 |
23859200 |
|
2300 |
27166659 |
Quaternion |
E |
May 16, 2017, 6:12 p.m. |
OK |
Python 3 |
TESTS |
73 |
639 |
21401600 |
|
2300 |
27212836 |
ravi.kaushal97 |
E |
May 19, 2017, 11:06 a.m. |
OK |
Python 3 |
TESTS |
73 |
889 |
17203200 |
|
2300 |
38568581 |
pyrus |
E |
May 23, 2018, 5:13 p.m. |
OK |
Python 3 |
TESTS |
73 |
951 |
21504000 |
|
2300 |
27171513 |
pr3pony |
E |
May 17, 2017, 3:31 a.m. |
OK |
Python 3 |
TESTS |
73 |
1014 |
5939200 |
|
2300 |
remove filters
Back to search problems