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'BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes a genre or a theme of this application (like "game", "business", or "education"). The categories are given as integers between 1 and n , inclusive; the i -th application has category c_i . You can choose m -- the number of screens and s -- the size of each screen. You need to fit all n icons of the applications (one icon representing one application) meeting the following requirements: Your task is to find the minimal possible number of screens m . The first line contains an integer t ( 1 <= t <= 10 ,000 ) -- the number of test cases in the input. Then t test cases follow. The first line of each test case contains an integer n ( 1 <= n <= 2 cdot10^6 ) -- the number of the icons. The second line contains n integers c_1, c_2, ... , c_n ( 1 <= c_i <= n ), where c_i is the category of the i -th application. It is guaranteed that the sum of the values of n for all test cases in the input does not exceed 2 cdot10^6 . Print t integers -- the answers to the given test cases in the order they follow in the input. The answer to a test case is an integer m -- the minimum number of screens on which all n icons can be placed satisfying the given requirements. In the first test case of the example, all the icons can be placed on three screens of size 4 : a screen with 4 icons of the category 1 , a screen with 3 icons of the category 1 , and a screen with 4 icons of the category 5 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
66100821 |
gyh20 |
J |
Dec. 1, 2019, 8:21 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
124 |
16076800 |
|
1900 |
66123746 |
myx12345 chenkuowen |
J |
Dec. 1, 2019, 10:22 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
234 |
32051200 |
|
1900 |
66093399 |
djh123 msuwakow Logey |
J |
Dec. 1, 2019, 7:37 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
265 |
29388800 |
|
1900 |
66100811 |
xrdog lts_ |
J |
Dec. 1, 2019, 8:21 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
327 |
67481600 |
|
1900 |
66100780 |
htc002 |
J |
Dec. 1, 2019, 8:21 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
358 |
36659200 |
|
1900 |
66116098 |
CHENRUIJIE wanghaoze nanatoday |
J |
Dec. 1, 2019, 9:50 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
405 |
8192000 |
|
1900 |
66102626 |
haituan134 lamnhh qcuong98 |
J |
Dec. 1, 2019, 8:36 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
405 |
20582400 |
|
1900 |
66093302 |
Isonan |
J |
Dec. 1, 2019, 7:35 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
405 |
31846400 |
|
1900 |
66115887 |
yang12138 |
J |
Dec. 1, 2019, 9:46 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
420 |
7987200 |
|
1900 |
66097199 |
Shef |
J |
Dec. 1, 2019, 8:04 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
421 |
48128000 |
|
1900 |
66107681 |
tokitsukaze |
J |
Dec. 1, 2019, 9:05 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
155 |
20787200 |
|
1900 |
66115691 |
lavender730 liouzhou_101 |
J |
Dec. 1, 2019, 9:42 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
358 |
106905600 |
|
1900 |
66118489 |
Gallinari for_lover_papa hyta4982 |
J |
Dec. 1, 2019, 9:59 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
499 |
15974400 |
|
1900 |
66126217 |
szw720711 2020skyfall BEAR0131 |
J |
Dec. 1, 2019, 10:28 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
499 |
36659200 |
|
1900 |
66100789 |
sjcakioi sjc061031 htc001 |
J |
Dec. 1, 2019, 8:21 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
514 |
36659200 |
|
1900 |
66116204 |
MasterTr Avny nghethuat102 |
J |
Dec. 1, 2019, 9:52 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
561 |
20684800 |
|
1900 |
66100689 |
DerekFeng BlahDuckling747 xuziyuan |
J |
Dec. 1, 2019, 8:19 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
561 |
24064000 |
|
1900 |
66096108 |
PinkRabbit |
J |
Dec. 1, 2019, 7:57 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
561 |
24064000 |
|
1900 |
66093504 |
little_waxberry yht_boyfriend ppc_qjd |
J |
Dec. 1, 2019, 7:39 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
561 |
24064000 |
|
1900 |
66118599 |
shdut |
J |
Dec. 1, 2019, 10:02 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
576 |
17203200 |
|
1900 |
66100919 |
LiM_256 dengyaotriangle interestingLSY |
J |
Dec. 1, 2019, 8:23 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
124 |
22118400 |
|
1900 |
66133866 |
kingfran1907 vito1036 Dorito911 |
J |
Dec. 1, 2019, 11:30 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
280 |
20684800 |
|
1900 |
66096265 |
dream_maker cxr_o__o_cxr yyf0309 |
J |
Dec. 1, 2019, 8 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
467 |
32153600 |
|
1900 |
66102624 |
Mitsuhaw |
J |
Dec. 1, 2019, 8:36 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
514 |
36659200 |
|
1900 |
66101038 |
.I. |
J |
Dec. 1, 2019, 8:26 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
546 |
24064000 |
|
1900 |
66109209 |
dead_blue |
J |
Dec. 1, 2019, 9:08 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
561 |
20684800 |
|
1900 |
66094314 |
evenharder SUDAL SoulTch |
J |
Dec. 1, 2019, 7:46 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
576 |
16076800 |
|
1900 |
66098374 |
KMAASZRAA Atreus Kalam |
J |
Dec. 1, 2019, 8:10 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
576 |
20684800 |
|
1900 |
66111676 |
pootis |
J |
Dec. 1, 2019, 9:29 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
577 |
7987200 |
|
1900 |
66091613 |
aid |
J |
Dec. 1, 2019, 7:22 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
592 |
7987200 |
|
1900 |
66102705 |
LightRay curly mashinist |
J |
Dec. 1, 2019, 8:38 a.m. |
OK |
Java 8 |
TESTS |
43 |
1606 |
211660800 |
|
1900 |
66133389 |
jjluczyn |
J |
Dec. 1, 2019, 11:20 a.m. |
OK |
Java 8 |
TESTS |
43 |
1949 |
270950400 |
|
1900 |
66107626 |
knightL |
J |
Dec. 1, 2019, 9:04 a.m. |
OK |
Kotlin |
TESTS |
43 |
2012 |
238387200 |
|
1900 |
66107615 |
peregrinus BrainFreeze |
J |
Dec. 1, 2019, 9:04 a.m. |
OK |
Mono C# |
TESTS |
43 |
826 |
279142400 |
|
1900 |
66129769 |
manish_joshi satyamcse nikeshthapa255 |
J |
Dec. 1, 2019, 10:56 a.m. |
OK |
PyPy 3 |
TESTS |
43 |
2183 |
150528000 |
|
1900 |
remove filters
Back to search problems