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"VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications. The latest A/B test suggests that users are reading recommended publications more actively if each category has a different number of publications within daily recommendations. The targeted algorithm can find a single interesting publication of i -th category within t_i seconds. What is the minimum total time necessary to add publications to the result of batch algorithm execution, so all categories have a different number of publications? You can't remove publications recommended by the batch algorithm. The first line of input consists of single integer n -- the number of news categories ( 1 <= n <= 200 ,000 ). The second line of input consists of n integers a_i -- the number of publications of i -th category selected by the batch algorithm ( 1 <= a_i <= 10^9 ). The third line of input consists of n integers t_i -- time it takes for targeted algorithm to find one new publication of category i ( 1 <= t_i <= 10^5) . Print one integer -- the minimal required time for the targeted algorithm to get rid of categories with the same size. In the first example, it is possible to find three publications of the second type, which will take 6 seconds. In the second example, all news categories contain a different number of publications. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
71889541 |
wyy2004 |
A |
Feb. 26, 2020, 1:03 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
77 |
7987200 |
|
1700 |
71896448 |
xht37 |
A |
Feb. 26, 2020, 5:46 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
78 |
10547200 |
|
1700 |
71890730 |
huanggs |
A |
Feb. 26, 2020, 2:07 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
78 |
12800000 |
|
1700 |
71966534 |
mmi366127 |
A |
Feb. 27, 2020, 10:49 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
109 |
3174400 |
|
1700 |
71889804 |
Pyqe |
A |
Feb. 26, 2020, 1:16 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
140 |
6348800 |
|
1700 |
71862874 |
DevC |
A |
Feb. 25, 2020, 2:03 p.m. |
OK |
GNU C++11 |
TESTS |
90 |
140 |
6348800 |
|
1700 |
71831562 |
JasonZhan |
A |
Feb. 25, 2020, 3:10 a.m. |
OK |
GNU C++11 |
TESTS |
90 |
140 |
21196800 |
|
1700 |
71705224 |
Aidos |
A |
Feb. 23, 2020, 4:19 p.m. |
OK |
GNU C++11 |
TESTS |
90 |
155 |
8089600 |
|
1700 |
71888060 |
luogu_bot3 |
A |
Feb. 25, 2020, 11:42 p.m. |
OK |
GNU C++11 |
TESTS |
90 |
156 |
6348800 |
|
1700 |
71858501 |
atoiz |
A |
Feb. 25, 2020, 12:58 p.m. |
OK |
GNU C++11 |
TESTS |
90 |
218 |
3174400 |
|
1700 |
71765331 |
rk42745417 |
A |
Feb. 24, 2020, 1:19 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
140 |
3174400 |
|
1700 |
71765114 |
deepdark-coldstars-light |
A |
Feb. 24, 2020, 1:16 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
140 |
6963200 |
|
1700 |
71952895 |
Kishan1432000 |
A |
Feb. 27, 2020, 5:56 a.m. |
OK |
GNU C++14 |
TESTS |
90 |
155 |
6348800 |
|
1700 |
71703656 |
pikmike |
A |
Feb. 23, 2020, 4:12 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
171 |
8192000 |
|
1700 |
71702972 |
step_by_step |
A |
Feb. 23, 2020, 4:10 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
171 |
8192000 |
|
1700 |
71703340 |
DmitryGrigorev |
A |
Feb. 23, 2020, 4:11 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
171 |
10342400 |
|
1700 |
71703359 |
cdkrot |
A |
Feb. 23, 2020, 4:11 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
186 |
8192000 |
|
1700 |
71704396 |
orz |
A |
Feb. 23, 2020, 4:15 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
186 |
9011200 |
|
1700 |
71704971 |
sava-cska |
A |
Feb. 23, 2020, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
202 |
8192000 |
|
1700 |
71705135 |
zeliboba |
A |
Feb. 23, 2020, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
90 |
202 |
10342400 |
|
1700 |
71710681 |
Smylic |
A |
Feb. 23, 2020, 4:45 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
140 |
3174400 |
|
1700 |
71731917 |
teleport |
A |
Feb. 23, 2020, 8:24 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
140 |
5324800 |
|
1700 |
71742228 |
iShibly |
A |
Feb. 24, 2020, 4:04 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
140 |
5632000 |
|
1700 |
71704367 |
.tx |
A |
Feb. 23, 2020, 4:15 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
140 |
9011200 |
|
1700 |
71703249 |
nikgaevoy |
A |
Feb. 23, 2020, 4:11 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
155 |
3174400 |
|
1700 |
71704180 |
Ra16bit |
A |
Feb. 23, 2020, 4:14 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
155 |
3993600 |
|
1700 |
71706022 |
despair |
A |
Feb. 23, 2020, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
155 |
4812800 |
|
1700 |
71704055 |
KAN |
A |
Feb. 23, 2020, 4:14 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
155 |
4812800 |
|
1700 |
71703074 |
Golovanov399 |
A |
Feb. 23, 2020, 4:11 p.m. |
OK |
GNU C++17 |
TESTS |
90 |
156 |
3174400 |
|
1700 |
71743988 |
chocopuu |
A |
Feb. 24, 2020, 5:04 a.m. |
OK |
GNU C++17 |
TESTS |
90 |
156 |
10649600 |
|
1700 |
71724796 |
eatmore |
A |
Feb. 23, 2020, 6:18 p.m. |
OK |
Java 11 |
TESTS |
90 |
358 |
8499200 |
|
1700 |
71705343 |
ilyakor |
A |
Feb. 23, 2020, 4:19 p.m. |
OK |
Java 11 |
TESTS |
90 |
467 |
14540800 |
|
1700 |
71705133 |
Musin |
A |
Feb. 23, 2020, 4:18 p.m. |
OK |
Java 11 |
TESTS |
90 |
748 |
43212800 |
|
1700 |
71705673 |
mmaxio |
A |
Feb. 23, 2020, 4:21 p.m. |
OK |
Java 8 |
TESTS |
90 |
326 |
7372800 |
|
1700 |
71704143 |
VArtem |
A |
Feb. 23, 2020, 4:14 p.m. |
OK |
Java 8 |
TESTS |
90 |
436 |
28876800 |
|
1700 |
71714406 |
DarLam |
A |
Feb. 23, 2020, 5:06 p.m. |
OK |
Java 8 |
TESTS |
90 |
545 |
17920000 |
|
1700 |
71720981 |
deNULL |
A |
Feb. 23, 2020, 5:51 p.m. |
OK |
Java 8 |
TESTS |
90 |
732 |
33382400 |
|
1700 |
71705917 |
alexyz |
A |
Feb. 23, 2020, 4:22 p.m. |
OK |
Java 8 |
TESTS |
90 |
748 |
26009600 |
|
1700 |
71706985 |
Slamur |
A |
Feb. 23, 2020, 4:27 p.m. |
OK |
Java 8 |
TESTS |
90 |
935 |
56832000 |
|
1700 |
71743761 |
rotoZOOM |
A |
Feb. 24, 2020, 4:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
90 |
171 |
5632000 |
|
1700 |
71763731 |
gnomina007 |
A |
Feb. 24, 2020, 12:48 p.m. |
OK |
MS C++ 2017 |
TESTS |
90 |
483 |
17715200 |
|
1700 |
71713639 |
KocherginDaniil |
A |
Feb. 23, 2020, 5:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
90 |
561 |
22835200 |
|
1700 |
71912457 |
soujiokita |
A |
Feb. 26, 2020, 12:14 p.m. |
OK |
PyPy 3 |
TESTS |
90 |
1248 |
27340800 |
|
1700 |
71719164 |
ostroumov |
A |
Feb. 23, 2020, 5:38 p.m. |
OK |
Python 3 |
TESTS |
90 |
1544 |
36556800 |
|
1700 |
71818987 |
BadDuck |
A |
Feb. 24, 2020, 6:53 p.m. |
OK |
Scala |
TESTS |
90 |
1216 |
75878400 |
|
1700 |
remove filters
Back to search problems