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"Digital collectible card games have become very popular recently. So Vova decided to try one of these. Vova has n cards in his collection. Each of these cards is characterised by its power pi, magic number ci and level li. Vova wants to build a deck with total power not less than k, but magic numbers may not allow him to do so -- Vova can't place two cards in a deck if the sum of the magic numbers written on these cards is a prime number. Also Vova cannot use a card if its level is greater than the level of Vova's character. At the moment Vova's character's level is 1. Help Vova to determine the minimum level he needs to reach in order to build a deck with the required total power. The first line contains two integers n and k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000). Then n lines follow, each of these lines contains three numbers that represent the corresponding card: pi, ci and li (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89pi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891000, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100000, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89li xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). If Vova won't be able to build a deck with required power, print xe2 x80 x89- xe2 x80 x891. Otherwise print the minimum level Vova has to reach in order to build a deck. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
27160807 |
1919810 |
F |
May 16, 2017, 1:36 p.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
0 |
|
2500 |
27336804 |
Menci |
F |
May 25, 2017, 12:46 p.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
102400 |
|
2500 |
27333656 |
Menci |
F |
May 25, 2017, 10:11 a.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
102400 |
|
2500 |
27172813 |
abcdef6199 |
F |
May 17, 2017, 5:41 a.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
102400 |
|
2500 |
27207029 |
cdsfcesf |
F |
May 19, 2017, 3:23 a.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
204800 |
|
2500 |
27296205 |
Mhammad1 |
F |
May 23, 2017, 7:37 a.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
307200 |
|
2500 |
27225317 |
Leonardo_Blanger |
F |
May 19, 2017, 11:05 p.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
307200 |
|
2500 |
27184044 |
huangzhen |
F |
May 17, 2017, 5:02 p.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
307200 |
|
2500 |
27169217 |
krijgertje |
F |
May 16, 2017, 9:59 p.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
307200 |
|
2500 |
27328640 |
Herrwerner |
F |
May 25, 2017, 3:23 a.m. |
OK |
GNU C++ |
TESTS |
34 |
15 |
409600 |
|
2500 |
27217919 |
krigan |
F |
May 19, 2017, 3:50 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
0 |
|
2500 |
27217734 |
krigan |
F |
May 19, 2017, 3:40 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
0 |
|
2500 |
27217647 |
krigan |
F |
May 19, 2017, 3:35 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
0 |
|
2500 |
27191308 |
RETURNCZQ |
F |
May 18, 2017, 6:34 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
0 |
|
2500 |
27845705 |
goodhao2012 |
F |
June 17, 2017, 12:25 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
102400 |
|
2500 |
27845659 |
goodhao2012 |
F |
June 17, 2017, 12:22 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
102400 |
|
2500 |
31264129 |
Yasola |
F |
Oct. 13, 2017, 3:05 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27277981 |
halyavin |
F |
May 22, 2017, 6:20 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27273337 |
halyavin |
F |
May 21, 2017, 8:19 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27267183 |
halyavin |
F |
May 21, 2017, 12:42 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
15 |
204800 |
|
2500 |
32130422 |
angelg |
F |
Nov. 7, 2017, 8:47 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27780200 |
barsa492 |
F |
June 14, 2017, 7:53 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27569098 |
ian9696 |
F |
June 4, 2017, 6:38 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27568990 |
ian9696 |
F |
June 4, 2017, 6:30 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27190482 |
aditya1495 |
F |
May 18, 2017, 5:24 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27186529 |
shadowatyy |
F |
May 17, 2017, 8:22 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27174103 |
hamayanhamayan |
F |
May 17, 2017, 7:07 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
27164790 |
spencer |
F |
May 16, 2017, 4:15 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
204800 |
|
2500 |
32131809 |
slonichobot |
F |
Nov. 7, 2017, 10:34 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
307200 |
|
2500 |
27430424 |
cabinfever |
F |
May 29, 2017, 2:04 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
15 |
307200 |
|
2500 |
43742343 |
Chameleon2460 |
F |
Oct. 3, 2018, 6:30 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
15 |
204800 |
|
2500 |
37082185 |
Hosamk92 |
F |
April 7, 2018, 8:52 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
15 |
3891200 |
|
2500 |
40083739 |
RayPatterson |
F |
July 8, 2018, 11:35 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
30 |
409600 |
|
2500 |
41128068 |
Baliuk |
F |
Aug. 2, 2018, 3:21 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
30 |
1024000 |
|
2500 |
42722342 |
vjudge1 |
F |
Sept. 10, 2018, 3:21 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
30 |
2867200 |
|
2500 |
38070336 |
haleyk100198 |
F |
May 9, 2018, 12:06 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
30 |
4608000 |
|
2500 |
68152226 |
tsutaj1458 |
F |
Jan. 4, 2020, 7:23 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
31 |
307200 |
|
2500 |
51485415 |
amnesiac_dusk |
F |
March 19, 2019, 1:21 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
31 |
307200 |
|
2500 |
46993284 |
YenSean |
F |
Dec. 14, 2018, 6:31 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
31 |
409600 |
|
2500 |
67393280 |
nikhil_c |
F |
Dec. 21, 2019, 8:58 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
31 |
512000 |
|
2500 |
27793386 |
PrakharJain |
F |
June 15, 2017, 12:31 p.m. |
OK |
Java 8 |
TESTS |
34 |
109 |
0 |
|
2500 |
27723924 |
Imaginary |
F |
June 11, 2017, 4:12 p.m. |
OK |
Java 8 |
TESTS |
34 |
124 |
0 |
|
2500 |
27208905 |
Omar_Morsi |
F |
May 19, 2017, 6:38 a.m. |
OK |
Java 8 |
TESTS |
34 |
124 |
0 |
|
2500 |
27204668 |
uwi |
F |
May 18, 2017, 9:04 p.m. |
OK |
Java 8 |
TESTS |
34 |
124 |
0 |
|
2500 |
28203360 |
PrakharJain |
F |
July 2, 2017, 4:57 a.m. |
OK |
Java 8 |
TESTS |
34 |
124 |
20582400 |
|
2500 |
27168936 |
Carson |
F |
May 16, 2017, 9:25 p.m. |
OK |
Java 8 |
TESTS |
34 |
1185 |
0 |
|
2500 |
27343157 |
flatline |
F |
May 25, 2017, 6:37 p.m. |
OK |
MS C# |
TESTS |
34 |
93 |
5734400 |
|
2500 |
37261396 |
Hzoi_joker |
F |
April 12, 2018, 10:28 p.m. |
OK |
MS C++ |
TESTS |
34 |
30 |
3584000 |
|
2500 |
49400720 |
vjudge4 |
F |
Feb. 3, 2019, 2:37 p.m. |
OK |
MS C++ |
TESTS |
34 |
31 |
13414400 |
|
2500 |
remove filters
Back to search problems