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"You are the head of a large enterprise. n people work at you, and n is odd (i. xe2 x80 x89e. n is not divisible by 2 ). You have to distribute salaries to your employees. Initially, you have s dollars for it, and the i -th employee should get a salary from l_i to r_i dollars. You have to distribute salaries in such a way that the median salary is maximum possible. To find the median of a sequence of odd length, you have to sort it and take the element in the middle position after sorting. For example: It is guaranteed that you have enough money to pay the minimum salary, i.e l_1 + l_2 + ... + l_n <= s . Note that you don't have to spend all your s dollars on salaries. You have to answer t test cases. The first line contains one integer t ( 1 <= t <= 2 cdot 10^5 ) -- the number of test cases. The first line of each query contains two integers n and s ( 1 <= n < 2 cdot 10^5 , 1 <= s <= 2 cdot 10^{14} ) -- the number of employees and the amount of money you have. The value n is not divisible by 2 . The following n lines of each query contain the information about employees. The i -th line contains two integers l_i and r_i ( 1 <= l_i <= r_i <= 10^9 ). It is guaranteed that the sum of all n over all queries does not exceed 2 cdot 10^5 . It is also guaranteed that you have enough money to pay the minimum salary to each employee, i. xe2 x80 x89e. sum limits_{i=1}^{n} l_i <= s . For each test case print one integer -- the maximum median salary that you can obtain. In the first test case, you can distribute salaries as follows: sal_1 = 12, sal_2 = 2, sal_3 = 11 ( sal_i is the salary of the i -th employee). Then the median salary is 11 . In the second test case, you have to pay 1337 dollars to the only employee. In the third test case, you can distribute salaries as follows: sal_1 = 4, sal"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
63336452 |
Pelmelnik2 |
D |
Oct. 24, 2019, 4:59 p.m. |
OK |
D |
TESTS |
25 |
467 |
4300800 |
|
1800 |
63340266 |
LaSWeeG |
D |
Oct. 24, 2019, 5:28 p.m. |
OK |
FPC |
TESTS |
25 |
811 |
4812800 |
|
1800 |
63863946 |
jschr |
D |
Oct. 30, 2019, 5:18 p.m. |
OK |
GNU C11 |
TESTS |
25 |
858 |
1638400 |
|
1800 |
63328915 |
pengin_2000 |
D |
Oct. 24, 2019, 4:23 p.m. |
OK |
GNU C11 |
TESTS |
25 |
873 |
6451200 |
|
1800 |
69644007 |
MostafaTwfiq |
D |
Jan. 27, 2020, 11:08 p.m. |
OK |
GNU C11 |
TESTS |
25 |
888 |
1638400 |
|
1800 |
63332546 |
Chipe1 |
D |
Oct. 24, 2019, 4:40 p.m. |
OK |
GNU C11 |
TESTS |
25 |
889 |
1638400 |
|
1800 |
63334685 |
rainboy |
D |
Oct. 24, 2019, 4:50 p.m. |
OK |
GNU C11 |
TESTS |
25 |
920 |
2457600 |
|
1800 |
63403608 |
pizdato |
D |
Oct. 25, 2019, 7:19 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
62 |
2457600 |
|
1800 |
63618505 |
okwedook |
D |
Oct. 27, 2019, 8:56 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
77 |
1638400 |
|
1800 |
63403522 |
pizdato |
D |
Oct. 25, 2019, 7:17 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
77 |
2457600 |
|
1800 |
63403395 |
pizdato |
D |
Oct. 25, 2019, 7:15 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
77 |
2457600 |
|
1800 |
63402270 |
pizdato |
D |
Oct. 25, 2019, 6:50 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
77 |
2457600 |
|
1800 |
63617591 |
okwedook |
D |
Oct. 27, 2019, 8:24 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
78 |
1638400 |
|
1800 |
63402970 |
pizdato |
D |
Oct. 25, 2019, 7:05 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
78 |
2457600 |
|
1800 |
63619113 |
okwedook |
D |
Oct. 27, 2019, 9:19 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
78 |
2457600 |
|
1800 |
63403593 |
pizdato |
D |
Oct. 25, 2019, 7:19 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
78 |
2457600 |
|
1800 |
63403163 |
pizdato |
D |
Oct. 25, 2019, 7:10 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
78 |
2457600 |
|
1800 |
63488212 |
BeNoble |
D |
Oct. 26, 2019, 2:04 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
78 |
1740800 |
|
1800 |
63324905 |
liouzhou_101 |
D |
Oct. 24, 2019, 4:06 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
171 |
7680000 |
|
1800 |
63391789 |
HipHop |
D |
Oct. 25, 2019, 3:28 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
187 |
1536000 |
|
1800 |
63323075 |
KaguraNana |
D |
Oct. 24, 2019, 3:59 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
187 |
8089600 |
|
1800 |
63703856 |
angrysqrt3 |
D |
Oct. 29, 2019, 8:14 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
202 |
7168000 |
|
1800 |
63323813 |
shamiaomiao |
D |
Oct. 24, 2019, 4:01 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
217 |
52121600 |
|
1800 |
63702931 |
201831990439 |
D |
Oct. 29, 2019, 7:55 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
218 |
1638400 |
|
1800 |
63340542 |
tokitsukaze |
D |
Oct. 24, 2019, 5:32 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
218 |
8089600 |
|
1800 |
63325270 |
fpeterfalvi |
D |
Oct. 24, 2019, 4:07 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
233 |
1638400 |
|
1800 |
64552520 |
KisekiPurin2019 |
D |
Nov. 9, 2019, 12:59 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
233 |
3993600 |
|
1800 |
63400298 |
neal |
D |
Oct. 25, 2019, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
77 |
1638400 |
|
1800 |
63400203 |
neal |
D |
Oct. 25, 2019, 6:04 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
77 |
1638400 |
|
1800 |
63399984 |
neal |
D |
Oct. 25, 2019, 5:59 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
77 |
1638400 |
|
1800 |
63400316 |
neal |
D |
Oct. 25, 2019, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
78 |
1638400 |
|
1800 |
63399855 |
neal |
D |
Oct. 25, 2019, 5:57 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
93 |
1433600 |
|
1800 |
63400050 |
neal |
D |
Oct. 25, 2019, 6 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
93 |
1433600 |
|
1800 |
63400254 |
neal |
D |
Oct. 25, 2019, 6:05 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
93 |
1638400 |
|
1800 |
63402653 |
pizdato |
D |
Oct. 25, 2019, 6:58 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
93 |
2457600 |
|
1800 |
66217299 |
.tx |
D |
Dec. 3, 2019, 9:29 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
124 |
1638400 |
|
1800 |
63348470 |
mohamedeltair |
D |
Oct. 24, 2019, 8:24 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
187 |
3174400 |
|
1800 |
63643603 |
synapse |
D |
Oct. 28, 2019, 8:54 a.m. |
OK |
Go |
TESTS |
25 |
265 |
5324800 |
|
1800 |
64780130 |
qianhailong |
D |
Nov. 13, 2019, 6:45 a.m. |
OK |
Go |
TESTS |
25 |
639 |
5427200 |
|
1800 |
63643266 |
synapse |
D |
Oct. 28, 2019, 8:48 a.m. |
OK |
Go |
TESTS |
25 |
670 |
5427200 |
|
1800 |
63649209 |
synapse |
D |
Oct. 28, 2019, 10:51 a.m. |
OK |
Go |
TESTS |
25 |
702 |
5427200 |
|
1800 |
63334092 |
caidodo0_0 |
D |
Oct. 24, 2019, 4:48 p.m. |
OK |
Go |
TESTS |
25 |
1357 |
85401600 |
|
1800 |
64769866 |
FKint |
D |
Nov. 12, 2019, 10:22 p.m. |
OK |
Haskell |
TESTS |
25 |
1247 |
44134400 |
|
1800 |
63653251 |
alex223 |
D |
Oct. 28, 2019, 11:59 a.m. |
OK |
Java 11 |
TESTS |
25 |
451 |
0 |
|
1800 |
64334687 |
Anonymous |
D |
Nov. 5, 2019, 9:04 p.m. |
OK |
Java 11 |
TESTS |
25 |
498 |
6758400 |
|
1800 |
63662230 |
pikapika00 |
D |
Oct. 28, 2019, 2:12 p.m. |
OK |
Java 11 |
TESTS |
25 |
499 |
0 |
|
1800 |
63612881 |
serafimkoo |
D |
Oct. 27, 2019, 6:05 p.m. |
OK |
Java 11 |
TESTS |
25 |
607 |
1740800 |
|
1800 |
63351886 |
vinhntndu |
D |
Oct. 24, 2019, 10:35 p.m. |
OK |
Java 11 |
TESTS |
25 |
638 |
5529600 |
|
1800 |
64746486 |
potatmen |
D |
Nov. 12, 2019, 1:43 p.m. |
OK |
Java 11 |
TESTS |
25 |
779 |
5632000 |
|
1800 |
63741607 |
TheSawan |
D |
Oct. 29, 2019, 5:09 p.m. |
OK |
Java 11 |
TESTS |
25 |
951 |
24371200 |
|
1800 |
63345069 |
Dukkha |
D |
Oct. 24, 2019, 6:57 p.m. |
OK |
Java 11 |
TESTS |
25 |
1310 |
0 |
|
1800 |
64555122 |
lpls1 |
D |
Nov. 9, 2019, 3:06 a.m. |
OK |
Java 11 |
TESTS |
25 |
1637 |
6246400 |
|
1800 |
68452821 |
cribabby |
D |
Jan. 9, 2020, 2:58 p.m. |
OK |
Java 11 |
TESTS |
25 |
1872 |
2969600 |
|
1800 |
63420918 |
mufaddalnaya |
D |
Oct. 26, 2019, 6:22 a.m. |
OK |
Java 8 |
TESTS |
25 |
218 |
0 |
|
1800 |
63422063 |
mufaddalnaya |
D |
Oct. 26, 2019, 6:43 a.m. |
OK |
Java 8 |
TESTS |
25 |
233 |
0 |
|
1800 |
64287136 |
chojh1222 |
D |
Nov. 5, 2019, 5:25 a.m. |
OK |
Java 8 |
TESTS |
25 |
249 |
0 |
|
1800 |
64287115 |
chojh1222 |
D |
Nov. 5, 2019, 5:24 a.m. |
OK |
Java 8 |
TESTS |
25 |
249 |
0 |
|
1800 |
63418187 |
mufaddalnaya |
D |
Oct. 26, 2019, 5:21 a.m. |
OK |
Java 8 |
TESTS |
25 |
296 |
0 |
|
1800 |
63398906 |
polyakoff |
D |
Oct. 25, 2019, 5:36 p.m. |
OK |
Java 8 |
TESTS |
25 |
342 |
4505600 |
|
1800 |
63385769 |
RitvikMittal |
D |
Oct. 25, 2019, 1:43 p.m. |
OK |
Java 8 |
TESTS |
25 |
343 |
3584000 |
|
1800 |
63343659 |
prem_cse |
D |
Oct. 24, 2019, 6:27 p.m. |
OK |
Java 8 |
TESTS |
25 |
373 |
0 |
|
1800 |
64082371 |
p_unit |
D |
Nov. 2, 2019, 10:34 a.m. |
OK |
Java 8 |
TESTS |
25 |
373 |
11673600 |
|
1800 |
63359708 |
avijit_agarwal |
D |
Oct. 25, 2019, 4:55 a.m. |
OK |
Java 8 |
TESTS |
25 |
374 |
5120000 |
|
1800 |
63364928 |
Spheniscine |
D |
Oct. 25, 2019, 7:07 a.m. |
OK |
Kotlin |
TESTS |
25 |
342 |
5734400 |
|
1800 |
63364342 |
Spheniscine |
D |
Oct. 25, 2019, 6:55 a.m. |
OK |
Kotlin |
TESTS |
25 |
358 |
5734400 |
|
1800 |
66994101 |
yuranich |
D |
Dec. 15, 2019, 10:57 p.m. |
OK |
Kotlin |
TESTS |
25 |
2339 |
12902400 |
|
1800 |
65805589 |
artworks |
D |
Nov. 27, 2019, 8:46 a.m. |
OK |
Mono C# |
TESTS |
25 |
701 |
11059200 |
|
1800 |
69452397 |
mban259 |
D |
Jan. 24, 2020, 6:52 a.m. |
OK |
Mono C# |
TESTS |
25 |
733 |
13312000 |
|
1800 |
63325028 |
Yupiteru |
D |
Oct. 24, 2019, 4:06 p.m. |
OK |
Mono C# |
TESTS |
25 |
889 |
156569600 |
|
1800 |
69846586 |
ngtkana |
D |
Jan. 30, 2020, 2:29 p.m. |
OK |
Mono C# |
TESTS |
25 |
2011 |
17100800 |
|
1800 |
63358605 |
vjudge4 |
D |
Oct. 25, 2019, 4:16 a.m. |
OK |
MS C++ |
TESTS |
25 |
187 |
1638400 |
|
1800 |
64864874 |
vjudge5 |
D |
Nov. 14, 2019, 5:38 a.m. |
OK |
MS C++ |
TESTS |
25 |
202 |
3174400 |
|
1800 |
63415827 |
seh631638554 |
D |
Oct. 26, 2019, 4:06 a.m. |
OK |
MS C++ |
TESTS |
25 |
233 |
3174400 |
|
1800 |
63427764 |
vjudge2 |
D |
Oct. 26, 2019, 8:19 a.m. |
OK |
MS C++ |
TESTS |
25 |
233 |
3276800 |
|
1800 |
63431020 |
vjudge4 |
D |
Oct. 26, 2019, 9:08 a.m. |
OK |
MS C++ |
TESTS |
25 |
249 |
6041600 |
|
1800 |
64126015 |
vjudge3 |
D |
Nov. 3, 2019, 4:46 a.m. |
OK |
MS C++ |
TESTS |
25 |
265 |
6041600 |
|
1800 |
64130640 |
vjudge2 |
D |
Nov. 3, 2019, 6:43 a.m. |
OK |
MS C++ |
TESTS |
25 |
280 |
3174400 |
|
1800 |
63422908 |
vjudge1 |
D |
Oct. 26, 2019, 6:59 a.m. |
OK |
MS C++ |
TESTS |
25 |
296 |
3174400 |
|
1800 |
63990371 |
yanghuimin |
D |
Nov. 1, 2019, 12:57 p.m. |
OK |
MS C++ |
TESTS |
25 |
312 |
3174400 |
|
1800 |
66454587 |
vjudge5 |
D |
Dec. 7, 2019, 12:43 p.m. |
OK |
MS C++ |
TESTS |
25 |
420 |
3174400 |
|
1800 |
63331421 |
AleksanderBalobanov |
D |
Oct. 24, 2019, 4:35 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
311 |
2457600 |
|
1800 |
63325613 |
youx |
D |
Oct. 24, 2019, 4:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
312 |
5939200 |
|
1800 |
64889590 |
ICEY777 |
D |
Nov. 14, 2019, 2:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
343 |
3174400 |
|
1800 |
64889622 |
vjudge5 |
D |
Nov. 14, 2019, 2:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
343 |
3174400 |
|
1800 |
63359167 |
taekop |
D |
Oct. 25, 2019, 4:35 a.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
374 |
9113600 |
|
1800 |
63428088 |
vjudge5 |
D |
Oct. 26, 2019, 8:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
405 |
3174400 |
|
1800 |
63462859 |
2462478392 |
D |
Oct. 26, 2019, 11:46 a.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
655 |
6246400 |
|
1800 |
63332543 |
Prokopiy |
D |
Oct. 24, 2019, 4:40 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
686 |
1740800 |
|
1800 |
63327391 |
dkyun |
D |
Oct. 24, 2019, 4:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
717 |
3891200 |
|
1800 |
63332877 |
sas |
D |
Oct. 24, 2019, 4:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
717 |
8601600 |
|
1800 |
63647460 |
yumtam |
D |
Oct. 28, 2019, 10:15 a.m. |
OK |
PyPy 2 |
TESTS |
25 |
748 |
23859200 |
|
1800 |
63329259 |
MVP |
D |
Oct. 24, 2019, 4:24 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
763 |
23961600 |
|
1800 |
63341432 |
H4Wk3ye |
D |
Oct. 24, 2019, 5:46 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
2917 |
61030400 |
|
1800 |
63341394 |
H4Wk3ye |
D |
Oct. 24, 2019, 5:45 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
2963 |
61235200 |
|
1800 |
63341323 |
H4Wk3ye |
D |
Oct. 24, 2019, 5:44 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
2979 |
61132800 |
|
1800 |
63746535 |
FLOP |
D |
Oct. 29, 2019, 6:40 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
733 |
9420800 |
|
1800 |
65689349 |
buchannon1 |
D |
Nov. 25, 2019, 3:26 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
1044 |
51916800 |
|
1800 |
63333696 |
nagitaosu |
D |
Oct. 24, 2019, 4:46 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1076 |
21811200 |
|
1800 |
69093783 |
roaris |
D |
Jan. 19, 2020, 11:13 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
1184 |
25497600 |
|
1800 |
63329611 |
macaroni |
D |
Oct. 24, 2019, 4:26 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1262 |
19353600 |
|
1800 |
63401220 |
karthikeya619 |
D |
Oct. 25, 2019, 6:25 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1310 |
24268800 |
|
1800 |
63402136 |
karthikeya619 |
D |
Oct. 25, 2019, 6:47 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1357 |
24268800 |
|
1800 |
63351543 |
pizdato |
D |
Oct. 24, 2019, 10:20 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1466 |
19865600 |
|
1800 |
66418390 |
wishcode |
D |
Dec. 6, 2019, 5:56 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1512 |
11366400 |
|
1800 |
63379896 |
pizdato |
D |
Oct. 25, 2019, 12:10 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1513 |
18944000 |
|
1800 |
63608447 |
_Michael_ |
D |
Oct. 27, 2019, 4:08 p.m. |
OK |
Python 2 |
TESTS |
25 |
2854 |
39424000 |
|
1800 |
63369626 |
NocturneBflat |
D |
Oct. 25, 2019, 8:52 a.m. |
OK |
Python 3 |
TESTS |
25 |
2480 |
26521600 |
|
1800 |
63419803 |
MinecraftFuns |
D |
Oct. 26, 2019, 6 a.m. |
OK |
Python 3 |
TESTS |
25 |
2496 |
26624000 |
|
1800 |
63746666 |
FLOP |
D |
Oct. 29, 2019, 6:43 p.m. |
OK |
Python 3 |
TESTS |
25 |
2963 |
20172800 |
|
1800 |
63331584 |
alpha_virginis |
D |
Oct. 24, 2019, 4:35 p.m. |
OK |
Rust |
TESTS |
25 |
233 |
7168000 |
|
1800 |
69512511 |
akiradeveloper |
D |
Jan. 25, 2020, 10:56 a.m. |
OK |
Rust |
TESTS |
25 |
561 |
7270400 |
|
1800 |
64306998 |
folen |
D |
Nov. 5, 2019, 11:41 a.m. |
OK |
Rust |
TESTS |
25 |
2199 |
12390400 |
|
1800 |
64308653 |
folen |
D |
Nov. 5, 2019, 12:06 p.m. |
OK |
Rust |
TESTS |
25 |
2214 |
12390400 |
|
1800 |
63325803 |
yoshrc |
D |
Oct. 24, 2019, 4:09 p.m. |
OK |
Rust |
TESTS |
25 |
2245 |
6246400 |
|
1800 |
63324818 |
yakamoto |
D |
Oct. 24, 2019, 4:05 p.m. |
OK |
Scala |
TESTS |
25 |
1091 |
0 |
|
1800 |
remove filters
Back to search problems