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 playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game. The boss battle consists of n turns. During each turn, you will get several cards. Each card has two parameters: its cost c_i and damage d_i . You may play some of your cards during each turn in some sequence (you choose the cards and the exact order they are played), as long as the total cost of the cards you play during the turn does not exceed 3 . After playing some (possibly zero) cards, you end your turn, and all cards you didn't play are discarded. Note that you can use each card at most once. Your character has also found an artifact that boosts the damage of some of your actions: every 10 -th card you play deals double damage. What is the maximum possible damage you can deal during n turns? The first line contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of turns. Then n blocks of input follow, the i -th block representing the cards you get during the i -th turn. Each block begins with a line containing one integer k_i ( 1 <= k_i <= 2 cdot 10^5 ) -- the number of cards you get during i -th turn. Then k_i lines follow, each containing two integers c_j and d_j ( 1 <= c_j <= 3 , 1 <= d_j <= 10^9 ) -- the parameters of the corresponding card. It is guaranteed that sum limits_{i = 1}^{n} k_i <= 2 cdot 10^5 . Print one integer -- the maximum damage you may deal. In the example test the best course of action is as follows: During the first turn, play all three cards in any order and deal 18 damage. During the second turn, play both cards and deal 7 damage. During the third turn, play the first and the third card and deal 13 damage. During the fourth turn, play the first and the third card and deal 25 damage. During the fifth turn, play the only card, which will deal double"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
55563349 |
cpy |
F |
June 14, 2019, 1:55 p.m. |
OK |
D |
TESTS |
21 |
498 |
99942400 |
|
2500 |
55578412 |
cpy |
F |
June 15, 2019, 4:23 a.m. |
OK |
D |
TESTS |
21 |
545 |
99942400 |
|
2500 |
57371766 |
sansen |
F |
July 20, 2019, 11:08 a.m. |
OK |
GNU C11 |
TESTS |
21 |
78 |
0 |
|
2500 |
61364328 |
shuyingte |
F |
Sept. 27, 2019, 1:04 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
46 |
0 |
|
2500 |
55610703 |
ReaLNero1 |
F |
June 16, 2019, 5:31 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
46 |
18022400 |
|
2500 |
55421806 |
Frame233 |
F |
June 11, 2019, 6:54 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
46 |
18124800 |
|
2500 |
55848649 |
The_Crossing |
F |
June 21, 2019, 1:14 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
62 |
27648000 |
|
2500 |
55848659 |
The_Crossing |
F |
June 21, 2019, 1:15 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
62 |
27648000 |
|
2500 |
61397056 |
chenyewei_1234 |
F |
Sept. 28, 2019, 2:57 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
62 |
43315200 |
|
2500 |
59658968 |
ciao_sora |
F |
Aug. 29, 2019, 11:40 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
0 |
|
2500 |
55495346 |
Gaozijian |
F |
June 12, 2019, 12:16 p.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
0 |
|
2500 |
66895892 |
aysn |
F |
Dec. 15, 2019, 1:40 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
0 |
|
2500 |
58651585 |
MoRanSky |
F |
Aug. 12, 2019, 7:40 a.m. |
OK |
GNU C++11 |
TESTS |
21 |
93 |
16076800 |
|
2500 |
56306194 |
tokitsukaze |
F |
June 30, 2019, 11:57 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
62 |
2355200 |
|
2500 |
55387861 |
threepebbles |
F |
June 10, 2019, 8:20 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
108 |
4812800 |
|
2500 |
55388356 |
threepebbles |
F |
June 10, 2019, 8:34 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
109 |
2252800 |
|
2500 |
55580239 |
walht |
F |
June 15, 2019, 6:10 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
124 |
2252800 |
|
2500 |
67630430 |
Zetr0 |
F |
Dec. 26, 2019, 3:29 a.m. |
OK |
GNU C++14 |
TESTS |
21 |
139 |
0 |
|
2500 |
55408511 |
murugappan_s |
F |
June 10, 2019, 6:04 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
139 |
4198400 |
|
2500 |
55407656 |
never_settle |
F |
June 10, 2019, 5:32 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
139 |
20275200 |
|
2500 |
55537084 |
gasin |
F |
June 13, 2019, 5:03 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
140 |
4812800 |
|
2500 |
59445189 |
vito1036 |
F |
Aug. 25, 2019, 1:02 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
140 |
15974400 |
|
2500 |
56558840 |
boycute |
F |
July 5, 2019, 1:47 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
140 |
21913600 |
|
2500 |
55397577 |
HYDROXIDE |
F |
June 10, 2019, 12:29 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
109 |
0 |
|
2500 |
55400449 |
ShJ |
F |
June 10, 2019, 1:49 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
124 |
1638400 |
|
2500 |
56418021 |
Robis2019 |
F |
July 2, 2019, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
124 |
28467200 |
|
2500 |
57958771 |
knight-erraunt |
F |
July 29, 2019, 8:25 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
139 |
2662400 |
|
2500 |
58360682 |
heno239 |
F |
Aug. 6, 2019, 12:03 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
139 |
4300800 |
|
2500 |
56289192 |
gsoares |
F |
June 29, 2019, 10:22 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
139 |
4300800 |
|
2500 |
55522285 |
stArliGht |
F |
June 13, 2019, 9:11 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
139 |
4812800 |
|
2500 |
55397006 |
HanaYukii |
F |
June 10, 2019, 12:14 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
139 |
16179200 |
|
2500 |
58948889 |
kort0n |
F |
Aug. 17, 2019, 10:09 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
140 |
4300800 |
|
2500 |
55393486 |
2683331518 |
F |
June 10, 2019, 10:47 a.m. |
OK |
GNU C++17 |
TESTS |
21 |
140 |
14438400 |
|
2500 |
55754504 |
4mda4mda |
F |
June 19, 2019, 2:36 p.m. |
OK |
Java 8 |
TESTS |
21 |
218 |
0 |
|
2500 |
58146564 |
SpargelTarzan |
F |
Aug. 1, 2019, 9:57 p.m. |
OK |
Java 8 |
TESTS |
21 |
249 |
0 |
|
2500 |
55426471 |
dalt |
F |
June 11, 2019, 9:14 a.m. |
OK |
Java 8 |
TESTS |
21 |
249 |
0 |
|
2500 |
55410394 |
MagentaCobra |
F |
June 10, 2019, 7:19 p.m. |
OK |
Java 8 |
TESTS |
21 |
280 |
18841600 |
|
2500 |
55402008 |
jenish9599 |
F |
June 10, 2019, 2:31 p.m. |
OK |
Java 8 |
TESTS |
21 |
295 |
18636800 |
|
2500 |
55513358 |
Causality_ |
F |
June 13, 2019, 2:36 a.m. |
OK |
Java 8 |
TESTS |
21 |
296 |
18841600 |
|
2500 |
55409576 |
Kenb |
F |
June 10, 2019, 6:45 p.m. |
OK |
Java 8 |
TESTS |
21 |
296 |
19456000 |
|
2500 |
55411560 |
Ahmad_Elsagheer |
F |
June 10, 2019, 8:23 p.m. |
OK |
Java 8 |
TESTS |
21 |
296 |
39833600 |
|
2500 |
55483003 |
shivamcyfun |
F |
June 12, 2019, 6:24 a.m. |
OK |
Java 8 |
TESTS |
21 |
311 |
18841600 |
|
2500 |
55948205 |
kusomushi |
F |
June 22, 2019, 9:44 p.m. |
OK |
Java 8 |
TESTS |
21 |
342 |
4710400 |
|
2500 |
58139782 |
Spheniscine |
F |
Aug. 1, 2019, 5:37 p.m. |
OK |
Kotlin |
TESTS |
21 |
545 |
1433600 |
|
2500 |
58137435 |
Spheniscine |
F |
Aug. 1, 2019, 4:43 p.m. |
OK |
Kotlin |
TESTS |
21 |
561 |
1433600 |
|
2500 |
58136977 |
Spheniscine |
F |
Aug. 1, 2019, 4:31 p.m. |
OK |
Kotlin |
TESTS |
21 |
592 |
1433600 |
|
2500 |
55753030 |
Jamb0t |
F |
June 19, 2019, 1:48 p.m. |
OK |
Kotlin |
TESTS |
21 |
1403 |
83968000 |
|
2500 |
55919642 |
vjudge5 |
F |
June 22, 2019, 6:56 a.m. |
OK |
MS C++ |
TESTS |
21 |
93 |
0 |
|
2500 |
56601891 |
vjudge5 |
F |
July 6, 2019, 1:24 a.m. |
OK |
MS C++ |
TESTS |
21 |
124 |
39116800 |
|
2500 |
55593376 |
ItsNikolor |
F |
June 15, 2019, 1:38 p.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
171 |
17510400 |
|
2500 |
56144149 |
xsc |
F |
June 27, 2019, 5:15 a.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
187 |
8396800 |
|
2500 |
55733554 |
fatant |
F |
June 19, 2019, 1:10 a.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
249 |
28876800 |
|
2500 |
56404476 |
CtrlAlt |
F |
July 1, 2019, 6:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
265 |
17612800 |
|
2500 |
55593212 |
ItsNikolor |
F |
June 15, 2019, 1:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
452 |
16588800 |
|
2500 |
56030854 |
Mao_Z |
F |
June 25, 2019, 9:28 a.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
467 |
20070400 |
|
2500 |
55486285 |
0-jij-0 |
F |
June 12, 2019, 8 a.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
483 |
47616000 |
|
2500 |
55412228 |
Pricolno |
F |
June 10, 2019, 9:03 p.m. |
OK |
MS C++ 2017 |
TESTS |
21 |
654 |
19558400 |
|
2500 |
55738788 |
yumtam |
F |
June 19, 2019, 6:15 a.m. |
OK |
PyPy 2 |
TESTS |
21 |
733 |
31539200 |
|
2500 |
56427682 |
gatsko |
F |
July 2, 2019, 10:28 a.m. |
OK |
PyPy 2 |
TESTS |
21 |
888 |
22630400 |
|
2500 |
57960719 |
Pokeylope |
F |
July 29, 2019, 10:08 p.m. |
OK |
PyPy 3 |
TESTS |
21 |
1278 |
119910400 |
|
2500 |
55415417 |
SRAGON |
F |
June 11, 2019, 1:40 a.m. |
OK |
PyPy 3 |
TESTS |
21 |
1512 |
13926400 |
|
2500 |
65726325 |
sansen |
F |
Nov. 25, 2019, 11:39 p.m. |
OK |
Rust |
TESTS |
21 |
202 |
7884800 |
|
2500 |
remove filters
Back to search problems