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"Polycarp has prepared n competitive programming problems. The topic of the i -th problem is a_i , and some problems' topics may coincide. Polycarp has to host several thematic contests. All problems in each contest should have the same topic, and all contests should have pairwise distinct topics. He may not use all the problems. It is possible that there are no contests for some topics. Polycarp wants to host competitions on consecutive days, one contest per day. Polycarp wants to host a set of contests in such a way that: Your task is to calculate the maximum number of problems in the set of thematic contests. Note, that you should not maximize the number of contests. The first line of the input contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of problems Polycarp has prepared. The second line of the input contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ) where a_i is the topic of the i -th problem. Print one integer -- the maximum number of problems in the set of thematic contests. In the first example the optimal sequence of contests is: 2 problems of the topic 1 , 4 problems of the topic 2 , 8 problems of the topic 10 . In the second example the optimal sequence of contests is: 3 problems of the topic 3 , 6 problems of the topic 6 . In the third example you can take all the problems with the topic 1337 (the number of such problems is 3 so the answer is 3 ) and host a single contest. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
46470535 |
adityareddy22 |
E |
Dec. 2, 2018, 7:22 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
72 |
592 |
17817600 |
|
1800 |
47885347 |
vjudge2 |
E |
Jan. 3, 2019, 9:54 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
72 |
920 |
29491200 |
|
1800 |
47885330 |
toysmars |
E |
Jan. 3, 2019, 9:52 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
72 |
967 |
29491200 |
|
1800 |
46121893 |
rr_ |
E |
Nov. 23, 2018, 4:42 p.m. |
OK |
D |
TESTS |
72 |
109 |
36147200 |
|
1800 |
46121789 |
rr_ |
E |
Nov. 23, 2018, 4:39 p.m. |
OK |
D |
TESTS |
72 |
109 |
36147200 |
|
1800 |
46121706 |
rr_ |
E |
Nov. 23, 2018, 4:37 p.m. |
OK |
D |
TESTS |
72 |
109 |
36147200 |
|
1800 |
51472782 |
chaorenhaha |
E |
March 19, 2019, 7:36 a.m. |
OK |
FPC |
TESTS |
72 |
108 |
7987200 |
|
1800 |
46433588 |
mranjan7 |
E |
Dec. 1, 2018, 7:25 a.m. |
OK |
GNU C11 |
TESTS |
72 |
109 |
29900800 |
|
1800 |
46433555 |
mranjan7 |
E |
Dec. 1, 2018, 7:24 a.m. |
OK |
GNU C11 |
TESTS |
72 |
109 |
29900800 |
|
1800 |
46097475 |
luogu_bot3 |
E |
Nov. 23, 2018, 2:08 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
1638400 |
|
1800 |
46096767 |
Althen |
E |
Nov. 23, 2018, 1:16 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
1638400 |
|
1800 |
52239741 |
lyzqs |
E |
April 2, 2019, 3:18 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
1638400 |
|
1800 |
46109445 |
Itst |
E |
Nov. 23, 2018, 11:25 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
1638400 |
|
1800 |
46199514 |
luogu_bot1 |
E |
Nov. 25, 2018, 10:30 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
1740800 |
|
1800 |
48657201 |
ReaLNero1 |
E |
Jan. 21, 2019, 3:35 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
4812800 |
|
1800 |
54840950 |
HyscereXD |
E |
May 30, 2019, 12:48 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
7987200 |
|
1800 |
54845326 |
HyscereXD |
E |
May 30, 2019, 1:36 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
46 |
8089600 |
|
1800 |
57810952 |
TianSunXing |
E |
July 26, 2019, 5:18 p.m. |
OK |
GNU C++11 |
TESTS |
72 |
62 |
1433600 |
|
1800 |
57826314 |
TianJianXing |
E |
July 27, 2019, 3:20 a.m. |
OK |
GNU C++11 |
TESTS |
72 |
62 |
1433600 |
|
1800 |
50557981 |
xqbf |
E |
Feb. 27, 2019, 9:10 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
77 |
1536000 |
|
1800 |
47900625 |
threepebbles |
E |
Jan. 4, 2019, 1:52 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
77 |
1638400 |
|
1800 |
46676213 |
vjudge4 |
E |
Dec. 6, 2018, 9:54 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
1638400 |
|
1800 |
53307836 |
vjudge2 |
E |
April 26, 2019, 4:20 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
1638400 |
|
1800 |
46029291 |
baozoudemolimao |
E |
Nov. 21, 2018, 12:52 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
1638400 |
|
1800 |
46045195 |
smeke |
E |
Nov. 22, 2018, 12:49 a.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
1638400 |
|
1800 |
47900433 |
threepebbles |
E |
Jan. 4, 2019, 1:45 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
1638400 |
|
1800 |
47306829 |
Swan |
E |
Dec. 20, 2018, 5:14 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
2867200 |
|
1800 |
46126600 |
wleung_bvg |
E |
Nov. 23, 2018, 7:36 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
3276800 |
|
1800 |
53430274 |
vjudge4 |
E |
April 27, 2019, 3:53 p.m. |
OK |
GNU C++14 |
TESTS |
72 |
78 |
3993600 |
|
1800 |
57825947 |
TianSunXing |
E |
July 27, 2019, 3:06 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
77 |
1536000 |
|
1800 |
57800397 |
TianZuiXing |
E |
July 26, 2019, 1:04 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
77 |
1536000 |
|
1800 |
46676242 |
vjudge3 |
E |
Dec. 6, 2018, 9:54 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
78 |
1638400 |
|
1800 |
47622541 |
winee |
E |
Dec. 28, 2018, 1:30 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
78 |
2457600 |
|
1800 |
47183877 |
Lucina |
E |
Dec. 18, 2018, 1:29 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
78 |
3072000 |
|
1800 |
53305851 |
vjudge3 |
E |
April 26, 2019, 3:06 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
93 |
1638400 |
|
1800 |
46363659 |
_Lazarus_ |
E |
Nov. 29, 2018, 12:15 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
93 |
1638400 |
|
1800 |
46676199 |
1323590871 |
E |
Dec. 6, 2018, 9:53 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
93 |
1638400 |
|
1800 |
57825501 |
TianPingXing |
E |
July 27, 2019, 2:48 a.m. |
OK |
GNU C++17 |
TESTS |
72 |
93 |
1638400 |
|
1800 |
54421989 |
vjudge2 |
E |
May 20, 2019, 4 p.m. |
OK |
GNU C++17 |
TESTS |
72 |
93 |
1638400 |
|
1800 |
68715056 |
synapse |
E |
Jan. 13, 2020, 2:11 p.m. |
OK |
Go |
TESTS |
72 |
233 |
5324800 |
|
1800 |
68715749 |
vjudge1 |
E |
Jan. 13, 2020, 2:23 p.m. |
OK |
Go |
TESTS |
72 |
234 |
5324800 |
|
1800 |
46018993 |
2008061626 |
E |
Nov. 21, 2018, 6:36 a.m. |
OK |
Go |
TESTS |
72 |
234 |
5324800 |
|
1800 |
48016720 |
Illusions |
E |
Jan. 5, 2019, 11:56 p.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
3276800 |
|
1800 |
46038828 |
alibaba |
E |
Nov. 21, 2018, 6:05 p.m. |
OK |
Java 8 |
TESTS |
72 |
171 |
3276800 |
|
1800 |
58666231 |
JCKG |
E |
Aug. 12, 2019, 12:41 p.m. |
OK |
Java 8 |
TESTS |
72 |
187 |
3276800 |
|
1800 |
46023479 |
Andres1 |
E |
Nov. 21, 2018, 9:37 a.m. |
OK |
Java 8 |
TESTS |
72 |
202 |
0 |
|
1800 |
46760670 |
dyhu083 |
E |
Dec. 8, 2018, 1:18 p.m. |
OK |
Java 8 |
TESTS |
72 |
249 |
9216000 |
|
1800 |
46551272 |
revanthreddy85 |
E |
Dec. 3, 2018, 5:59 p.m. |
OK |
Java 8 |
TESTS |
72 |
265 |
9932800 |
|
1800 |
56545619 |
Garett |
E |
July 5, 2019, 7:30 a.m. |
OK |
Java 8 |
TESTS |
72 |
265 |
11571200 |
|
1800 |
65793038 |
Agnimandur |
E |
Nov. 27, 2019, 1:07 a.m. |
OK |
Java 8 |
TESTS |
72 |
280 |
15052800 |
|
1800 |
63296650 |
yaoct |
E |
Oct. 24, 2019, 1:08 p.m. |
OK |
Java 8 |
TESTS |
72 |
280 |
15462400 |
|
1800 |
46261341 |
hongquanntct |
E |
Nov. 26, 2018, 8:17 p.m. |
OK |
Java 8 |
TESTS |
72 |
280 |
16076800 |
|
1800 |
56634295 |
sashamc |
E |
July 6, 2019, 6:23 p.m. |
OK |
Kotlin |
TESTS |
72 |
561 |
22425600 |
|
1800 |
56633174 |
sashamc |
E |
July 6, 2019, 5:42 p.m. |
OK |
Kotlin |
TESTS |
72 |
576 |
22425600 |
|
1800 |
46935323 |
Mem |
E |
Dec. 12, 2018, 1:35 p.m. |
OK |
Mono C# |
TESTS |
72 |
171 |
29286400 |
|
1800 |
69031566 |
hibatibati |
E |
Jan. 18, 2020, 8:14 a.m. |
OK |
Mono C# |
TESTS |
72 |
218 |
36966400 |
|
1800 |
46936603 |
vjudge4 |
E |
Dec. 12, 2018, 2:12 p.m. |
OK |
MS C++ |
TESTS |
72 |
62 |
1228800 |
|
1800 |
46629068 |
vjudge3 |
E |
Dec. 5, 2018, 12:45 a.m. |
OK |
MS C++ |
TESTS |
72 |
62 |
1638400 |
|
1800 |
49345285 |
scorpiowf |
E |
Feb. 2, 2019, 5:05 a.m. |
OK |
MS C++ |
TESTS |
72 |
62 |
3276800 |
|
1800 |
48387820 |
vjudge4 |
E |
Jan. 14, 2019, 1:54 p.m. |
OK |
MS C++ |
TESTS |
72 |
77 |
2457600 |
|
1800 |
47622484 |
vjudge5 |
E |
Dec. 28, 2018, 1:28 p.m. |
OK |
MS C++ |
TESTS |
72 |
77 |
2457600 |
|
1800 |
50050947 |
vjudge3 |
E |
Feb. 17, 2019, 8:08 a.m. |
OK |
MS C++ |
TESTS |
72 |
78 |
1638400 |
|
1800 |
46628955 |
vjudge5 |
E |
Dec. 5, 2018, 12:35 a.m. |
OK |
MS C++ |
TESTS |
72 |
78 |
1638400 |
|
1800 |
47124813 |
vjudge1 |
E |
Dec. 16, 2018, 3:36 p.m. |
OK |
MS C++ |
TESTS |
72 |
78 |
2457600 |
|
1800 |
51621241 |
vjudge1 |
E |
March 21, 2019, 2:25 p.m. |
OK |
MS C++ |
TESTS |
72 |
78 |
2457600 |
|
1800 |
46579030 |
vjudge2 |
E |
Dec. 4, 2018, 10:23 a.m. |
OK |
MS C++ |
TESTS |
72 |
93 |
2457600 |
|
1800 |
57826753 |
TianJianXing |
E |
July 27, 2019, 3:36 a.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
93 |
1638400 |
|
1800 |
56005242 |
petko_mitkov |
E |
June 24, 2019, 3:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
93 |
2560000 |
|
1800 |
56003063 |
petko_mitkov |
E |
June 24, 2019, 2 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
93 |
2969600 |
|
1800 |
68033165 |
AleksanderBalobanov |
E |
Jan. 1, 2020, 10:31 a.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
171 |
9830400 |
|
1800 |
50938529 |
work_hard. |
E |
March 7, 2019, 3:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
202 |
8089600 |
|
1800 |
50933720 |
work_hard. |
E |
March 7, 2019, 3:08 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
218 |
22528000 |
|
1800 |
57808714 |
TianPingXing |
E |
July 26, 2019, 4:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
234 |
1638400 |
|
1800 |
57809249 |
TianSunXing |
E |
July 26, 2019, 4:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
296 |
7680000 |
|
1800 |
50401853 |
prakashn |
E |
Feb. 23, 2019, 6:35 p.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
296 |
8704000 |
|
1800 |
57826868 |
TianZuiXing |
E |
July 27, 2019, 3:42 a.m. |
OK |
MS C++ 2017 |
TESTS |
72 |
311 |
7270400 |
|
1800 |
54851510 |
gatsko |
E |
May 30, 2019, 4:50 p.m. |
OK |
PyPy 2 |
TESTS |
72 |
296 |
27238400 |
|
1800 |
47272632 |
Paixao |
E |
Dec. 19, 2018, 5:27 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
311 |
26726400 |
|
1800 |
50581737 |
EliasMera |
E |
Feb. 27, 2019, 10:07 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
326 |
25907200 |
|
1800 |
47831451 |
whatshisbucket |
E |
Jan. 2, 2019, 7:04 a.m. |
OK |
PyPy 3 |
TESTS |
72 |
327 |
25395200 |
|
1800 |
50894572 |
shaswat57 |
E |
March 6, 2019, 2:30 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
327 |
25497600 |
|
1800 |
46466770 |
kinte |
E |
Dec. 2, 2018, 3:59 a.m. |
OK |
PyPy 3 |
TESTS |
72 |
327 |
26624000 |
|
1800 |
50581648 |
vjudge1 |
E |
Feb. 27, 2019, 10:02 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
342 |
25702400 |
|
1800 |
48527760 |
nik-in-au |
E |
Jan. 18, 2019, 9:55 a.m. |
OK |
PyPy 3 |
TESTS |
72 |
343 |
27750400 |
|
1800 |
46094609 |
LordVader |
E |
Nov. 22, 2018, 10:12 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
358 |
25497600 |
|
1800 |
57283422 |
brosucks |
E |
July 18, 2019, 1:37 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
420 |
24166400 |
|
1800 |
61938175 |
ashok123 |
E |
Oct. 5, 2019, 6:35 p.m. |
OK |
PyPy 3 |
TESTS |
72 |
436 |
22937600 |
|
1800 |
48104803 |
julianferres |
E |
Jan. 9, 2019, 3:26 a.m. |
OK |
Python 3 |
TESTS |
72 |
218 |
16486400 |
|
1800 |
50691361 |
SamuelLH AJ05 phillotunru1 |
E |
March 2, 2019, 3:50 p.m. |
OK |
Python 3 |
TESTS |
72 |
218 |
17100800 |
|
1800 |
47441776 |
c1729 |
E |
Dec. 24, 2018, 2:14 a.m. |
OK |
Python 3 |
TESTS |
72 |
218 |
23347200 |
|
1800 |
50607200 |
PhilTheFish |
E |
Feb. 28, 2019, 3:06 p.m. |
OK |
Python 3 |
TESTS |
72 |
233 |
17408000 |
|
1800 |
47442121 |
c1729 |
E |
Dec. 24, 2018, 2:40 a.m. |
OK |
Python 3 |
TESTS |
72 |
233 |
23347200 |
|
1800 |
47442045 |
c1729 |
E |
Dec. 24, 2018, 2:34 a.m. |
OK |
Python 3 |
TESTS |
72 |
264 |
23347200 |
|
1800 |
46093585 |
mustafij |
E |
Nov. 22, 2018, 9:07 p.m. |
OK |
Python 3 |
TESTS |
72 |
265 |
16793600 |
|
1800 |
50607657 |
hanga97 |
E |
Feb. 28, 2019, 3:20 p.m. |
OK |
Python 3 |
TESTS |
72 |
311 |
16281600 |
|
1800 |
50321365 |
iamssk |
E |
Feb. 22, 2019, 2:41 p.m. |
OK |
Python 3 |
TESTS |
72 |
311 |
23654400 |
|
1800 |
46009840 |
shahed_shd |
E |
Nov. 20, 2018, 7:27 p.m. |
OK |
Python 3 |
TESTS |
72 |
311 |
23756800 |
|
1800 |
46248304 |
yakamoto |
E |
Nov. 26, 2018, 12:45 p.m. |
OK |
Scala |
TESTS |
72 |
732 |
19865600 |
|
1800 |
remove filters
Back to search problems