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'Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries. Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shrub or berries of the same color (red or blue). In other words, all berries in a basket must be from the same shrub or/and have the same color. For example, if there are two shrubs with 5 red and 2 blue berries in the first shrub and 2 red and 1 blue berries in the second shrub then Phoenix can fill 2 baskets of capacity 4 completely: Help Phoenix determine the maximum number of baskets he can fill completely! The first line contains two integers n and k ( 1 <= n, k <= 500 ) -- the number of shrubs and the basket capacity, respectively. The i -th of the next n lines contain two integers a_i and b_i ( 0 <= a_i, b_i <= 10^9 ) -- the number of red and blue berries in the i -th shrub, respectively. Output one integer -- the maximum number of baskets that Phoenix can fill completely. The first example is described above. In the second example, Phoenix can fill one basket fully using all the berries from the first (and only) shrub. In the third example, Phoenix cannot fill any basket completely because there are less than 5 berries in each shrub, less than 5 total red berries, and less than 5 total blue berries. In the fourth example, Phoenix can put all the red berries into baskets, leaving an extra blue berry behind. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
78705484 |
rainboy |
E |
May 1, 2020, 3:36 p.m. |
OK |
GNU C11 |
TESTS |
74 |
343 |
204800 |
|
2400 |
78747584 |
cugel |
E |
May 1, 2020, 6 p.m. |
OK |
GNU C++11 |
TESTS |
74 |
31 |
0 |
|
2400 |
78736312 |
gnyst001 |
E |
May 1, 2020, 4:44 p.m. |
OK |
GNU C++11 |
TESTS |
74 |
31 |
0 |
|
2400 |
78751391 |
xt0r3 |
E |
May 1, 2020, 6:28 p.m. |
OK |
GNU C++11 |
TESTS |
76 |
31 |
204800 |
|
2400 |
78752097 |
xt0r3 |
E |
May 1, 2020, 6:34 p.m. |
OK |
GNU C++11 |
TESTS |
76 |
31 |
307200 |
|
2400 |
78764739 |
SirirNicheBirirDokan |
E |
May 1, 2020, 9:33 p.m. |
OK |
GNU C++11 |
TESTS |
80 |
31 |
307200 |
|
2400 |
78767677 |
kingofgeedorah |
E |
May 1, 2020, 10:45 p.m. |
OK |
GNU C++11 |
TESTS |
81 |
31 |
307200 |
|
2400 |
78717322 |
01191020csl |
E |
May 1, 2020, 3:59 p.m. |
OK |
GNU C++11 |
TESTS |
74 |
46 |
307200 |
|
2400 |
78725289 |
axiomofchoice |
E |
May 1, 2020, 4:17 p.m. |
OK |
GNU C++11 |
TESTS |
74 |
46 |
307200 |
|
2400 |
78737248 |
ehuohz |
E |
May 1, 2020, 4:46 p.m. |
OK |
GNU C++11 |
TESTS |
74 |
61 |
512000 |
|
2400 |
78728477 |
Koosha_Mv |
E |
May 1, 2020, 4:24 p.m. |
OK |
GNU C++11 |
TESTS |
74 |
202 |
0 |
|
2400 |
78729132 |
Kalptaru |
E |
May 1, 2020, 4:25 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
31 |
0 |
|
2400 |
78728870 |
Gioto |
E |
May 1, 2020, 4:25 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
31 |
512000 |
|
2400 |
78717382 |
Sunney |
E |
May 1, 2020, 3:59 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
46 |
0 |
|
2400 |
78755814 |
stefdasca |
E |
May 1, 2020, 7:14 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
46 |
0 |
|
2400 |
78741566 |
ymahajan |
E |
May 1, 2020, 4:57 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
46 |
0 |
|
2400 |
78756086 |
stefdasca |
E |
May 1, 2020, 7:17 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
61 |
0 |
|
2400 |
78756187 |
stefdasca |
E |
May 1, 2020, 7:19 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
61 |
0 |
|
2400 |
78755614 |
stefdasca |
E |
May 1, 2020, 7:12 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
62 |
0 |
|
2400 |
78755997 |
stefdasca |
E |
May 1, 2020, 7:16 p.m. |
OK |
GNU C++14 |
TESTS |
76 |
77 |
0 |
|
2400 |
78764256 |
MrDecomposition |
E |
May 1, 2020, 9:23 p.m. |
OK |
GNU C++14 |
TESTS |
80 |
77 |
4812800 |
|
2400 |
78753342 |
nxzhoubz |
E |
May 1, 2020, 6:46 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
31 |
0 |
|
2400 |
78759404 |
tloinuy |
E |
May 1, 2020, 8:02 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
31 |
0 |
|
2400 |
78759114 |
RCG |
E |
May 1, 2020, 7:59 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
31 |
0 |
|
2400 |
78758408 |
steven.novaryo |
E |
May 1, 2020, 7:49 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
31 |
0 |
|
2400 |
78757725 |
steven.novaryo |
E |
May 1, 2020, 7:40 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
31 |
0 |
|
2400 |
78744758 |
FastestFinger |
E |
May 1, 2020, 5:03 p.m. |
OK |
GNU C++17 |
TESTS |
74 |
31 |
0 |
|
2400 |
78740802 |
Aggu_01000101 |
E |
May 1, 2020, 4:55 p.m. |
OK |
GNU C++17 |
TESTS |
74 |
31 |
0 |
|
2400 |
78738341 |
Ivang |
E |
May 1, 2020, 4:49 p.m. |
OK |
GNU C++17 |
TESTS |
74 |
31 |
0 |
|
2400 |
78750821 |
aryanc403 |
E |
May 1, 2020, 6:23 p.m. |
OK |
GNU C++17 |
TESTS |
76 |
31 |
102400 |
|
2400 |
78735717 |
viskonsin |
E |
May 1, 2020, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
74 |
31 |
204800 |
|
2400 |
78731725 |
VLamarca |
E |
May 1, 2020, 4:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
31 |
102400 |
|
2400 |
78711448 |
Temotoloraia |
E |
May 1, 2020, 3:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
31 |
2048000 |
|
2400 |
78713926 |
wrinx |
E |
May 1, 2020, 3:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
31 |
2867200 |
|
2400 |
78756053 |
stefdasca |
E |
May 1, 2020, 7:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
76 |
46 |
0 |
|
2400 |
78750688 |
aryanc403 |
E |
May 1, 2020, 6:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
76 |
46 |
102400 |
|
2400 |
78767487 |
-osdajigu- |
E |
May 1, 2020, 10:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
93 |
307200 |
|
2400 |
78749634 |
Leonidas |
E |
May 1, 2020, 6:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
76 |
140 |
0 |
|
2400 |
78709333 |
LittleLyrical |
E |
May 1, 2020, 3:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
155 |
0 |
|
2400 |
78733619 |
HappyCoder91 |
E |
May 1, 2020, 4:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
156 |
0 |
|
2400 |
78713504 |
qazswedx2 |
E |
May 1, 2020, 3:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
249 |
16179200 |
|
2400 |
78757664 |
uwi |
E |
May 1, 2020, 7:39 p.m. |
OK |
Java 11 |
TESTS |
76 |
795 |
0 |
|
2400 |
78742603 |
Dukkha |
E |
May 1, 2020, 4:59 p.m. |
OK |
Java 11 |
TESTS |
74 |
1154 |
0 |
|
2400 |
78759799 |
egaeus.code |
E |
May 1, 2020, 8:08 p.m. |
OK |
Java 11 |
TESTS |
76 |
1591 |
0 |
|
2400 |
78762248 |
YahiaSherif |
E |
May 1, 2020, 8:46 p.m. |
OK |
Java 8 |
TESTS |
78 |
124 |
0 |
|
2400 |
78767562 |
polyakoff |
E |
May 1, 2020, 10:42 p.m. |
OK |
Java 8 |
TESTS |
81 |
155 |
0 |
|
2400 |
78744244 |
polyakoff |
E |
May 1, 2020, 5:02 p.m. |
OK |
Java 8 |
TESTS |
74 |
171 |
0 |
|
2400 |
78756996 |
pi37 |
E |
May 1, 2020, 7:30 p.m. |
OK |
Java 8 |
TESTS |
76 |
670 |
0 |
|
2400 |
78762404 |
StayAwayFromBitches |
E |
May 1, 2020, 8:49 p.m. |
OK |
Java 8 |
TESTS |
78 |
1029 |
0 |
|
2400 |
78735679 |
SecondThread |
E |
May 1, 2020, 4:42 p.m. |
OK |
Java 8 |
TESTS |
74 |
1200 |
0 |
|
2400 |
78762910 |
StayAwayFromBitches |
E |
May 1, 2020, 8:58 p.m. |
OK |
Java 8 |
TESTS |
78 |
1762 |
0 |
|
2400 |
78763074 |
StayAwayFromBitches |
E |
May 1, 2020, 9:01 p.m. |
OK |
Java 8 |
TESTS |
78 |
1809 |
0 |
|
2400 |
78763005 |
StayAwayFromBitches |
E |
May 1, 2020, 9 p.m. |
OK |
Java 8 |
TESTS |
78 |
1809 |
0 |
|
2400 |
78759378 |
old_boo |
E |
May 1, 2020, 8:02 p.m. |
OK |
Kotlin |
TESTS |
76 |
124 |
0 |
|
2400 |
78756215 |
TadijaSebez |
E |
May 1, 2020, 7:19 p.m. |
OK |
Kotlin |
TESTS |
76 |
498 |
102400 |
|
2400 |
78714061 |
camypaper |
E |
May 1, 2020, 3:53 p.m. |
OK |
Mono C# |
TESTS |
74 |
1981 |
35840000 |
|
2400 |
78739422 |
vpike |
E |
May 1, 2020, 4:52 p.m. |
OK |
MS C++ 2017 |
TESTS |
74 |
795 |
4403200 |
|
2400 |
78731802 |
danilgrig |
E |
May 1, 2020, 4:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
74 |
1170 |
0 |
|
2400 |
78758442 |
danilgrig |
E |
May 1, 2020, 7:49 p.m. |
OK |
MS C++ 2017 |
TESTS |
76 |
1871 |
0 |
|
2400 |
78760623 |
toohellish |
E |
May 1, 2020, 8:21 p.m. |
OK |
PyPy 2 |
TESTS |
78 |
1684 |
2457600 |
|
2400 |
78760737 |
toohellish |
E |
May 1, 2020, 8:23 p.m. |
OK |
PyPy 2 |
TESTS |
78 |
1700 |
2355200 |
|
2400 |
78749693 |
pineriver |
E |
May 1, 2020, 6:14 p.m. |
OK |
PyPy 3 |
TESTS |
76 |
327 |
1945600 |
|
2400 |
78744334 |
MAO1112 |
E |
May 1, 2020, 5:03 p.m. |
OK |
PyPy 3 |
TESTS |
74 |
889 |
4505600 |
|
2400 |
78741184 |
moptranzistor |
E |
May 1, 2020, 4:56 p.m. |
OK |
PyPy 3 |
TESTS |
74 |
1965 |
3481600 |
|
2400 |
remove filters
Back to search problems