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"Monocarp is opening his own IT company. He wants to hire n programmers and m testers. There are n+m+1 candidates, numbered from 1 to n+m+1 in chronological order of their arriving time. The i -th candidate has programming skill a_i and testing skill b_i (a person's programming skill is different from their testing skill). The skill of the team is the sum of the programming skills of all candidates hired as programmers, and the sum of the testing skills of all candidates hired as testers. When a candidate arrives to interview, Monocarp tries to assign them to the most suitable position for them (if their programming skill is higher, then he hires them as a programmer, otherwise as a tester). If all slots for that position are filled, Monocarp assigns them to the other position. Your task is, for each candidate, calculate the skill of the team if everyone except them comes to interview. Note that it means that exactly n+m candidates will arrive, so all n+m positions in the company will be filled. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Each test case consists of three lines: Additional constraint on the input: the sum of (n + m + 1) over all test cases doesn't exceed 2 cdot 10^5 . For each test case, print n + m + 1 integers, where the i -th integer should be equal to the skill of the team if everyone except the i -th candidate comes to interview. Let's consider the third test case of the example: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
263509908 |
og.kostya |
C |
May 31, 2024, 2:10 p.m. |
OK |
C# 10 |
TESTS |
16 |
139 |
6758400 |
|
|
263402728 |
karamkontar |
C |
May 31, 2024, 3:10 a.m. |
OK |
C# 10 |
TESTS |
16 |
249 |
65536000 |
|
|
263699108 |
luogu_bot3 |
C |
June 2, 2024, 4:39 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
187 |
0 |
|
|
263566923 |
LaLeii |
C |
June 1, 2024, 3:10 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
187 |
0 |
|
|
263424349 |
zhenja |
C |
May 31, 2024, 6:49 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
187 |
0 |
|
|
263583508 |
LHJ520 |
C |
June 1, 2024, 6:20 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
187 |
3276800 |
|
|
263425906 |
fucker188 |
C |
May 31, 2024, 7:02 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
187 |
4812800 |
|
|
263566994 |
LaLeii |
C |
June 1, 2024, 3:11 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
202 |
0 |
|
|
263565554 |
MrPython |
C |
June 1, 2024, 2:48 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
202 |
0 |
|
|
263415006 |
309514366 |
C |
May 31, 2024, 5:30 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
202 |
0 |
|
|
263410394 |
raviteja3333 |
C |
May 31, 2024, 4:46 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
202 |
0 |
|
|
263400812 |
CH_Wang48 |
C |
May 31, 2024, 2:42 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
16 |
202 |
0 |
|
|
263694993 |
jims77 |
C |
June 2, 2024, 3:25 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
109 |
102400 |
|
|
263545607 |
ankitlal |
C |
May 31, 2024, 7:42 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
171 |
10956800 |
|
|
263584094 |
Eshan_12 |
C |
June 1, 2024, 6:26 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
186 |
0 |
|
|
263562594 |
rdcamelot |
C |
June 1, 2024, 1:59 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
186 |
0 |
|
|
263510264 |
Citypop |
C |
May 31, 2024, 2:13 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
186 |
0 |
|
|
263642306 |
anuj_iit_kanpur |
C |
June 1, 2024, 2:28 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
187 |
0 |
|
|
263629629 |
gauravbro69 |
C |
June 1, 2024, 12:35 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
187 |
0 |
|
|
263584246 |
nan01 |
C |
June 1, 2024, 6:27 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
187 |
0 |
|
|
263569942 |
sujay1029 |
C |
June 1, 2024, 3:48 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
187 |
0 |
|
|
263562785 |
AtomFirst |
C |
June 1, 2024, 2:03 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
16 |
187 |
0 |
|
|
263693633 |
N_z__ |
C |
June 2, 2024, 2:57 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
62 |
102400 |
|
|
263403491 |
CLT |
C |
May 31, 2024, 3:22 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
109 |
3686400 |
|
|
263602269 |
MIKEFENG |
C |
June 1, 2024, 8:56 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
109 |
8089600 |
|
|
263572557 |
aklk1ng |
C |
June 1, 2024, 4:19 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
0 |
|
|
263571702 |
dqu14 |
C |
June 1, 2024, 4:09 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
0 |
|
|
263401895 |
Mash.888 |
C |
May 31, 2024, 2:58 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
0 |
|
|
263383574 |
NewbiePupil |
C |
May 30, 2024, 8:06 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
0 |
|
|
263699130 |
zzuliLLL |
C |
June 2, 2024, 4:39 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
102400 |
|
|
263673281 |
raj_adi |
C |
June 1, 2024, 7:04 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
102400 |
|
|
263395345 |
SunXiaoChuan |
C |
May 31, 2024, 12:40 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
16 |
124 |
102400 |
|
|
263604474 |
tkddn5623 |
C |
June 1, 2024, 9:13 a.m. |
OK |
GNU C11 |
TESTS |
16 |
952 |
4096000 |
|
|
263594760 |
enthsxpzm |
C |
June 1, 2024, 7:54 a.m. |
OK |
GNU C11 |
TESTS |
16 |
984 |
4300800 |
|
|
263637819 |
percivalKyo |
C |
June 1, 2024, 1:48 p.m. |
OK |
GNU C11 |
TESTS |
16 |
999 |
2969600 |
|
|
263593760 |
enthsxpzm |
C |
June 1, 2024, 7:46 a.m. |
OK |
GNU C11 |
TESTS |
16 |
1046 |
4096000 |
|
|
263399132 |
wangck1998 |
C |
May 31, 2024, 2:11 a.m. |
OK |
GNU C11 |
TESTS |
16 |
1140 |
11264000 |
|
|
263599242 |
tkddn5623 |
C |
June 1, 2024, 8:31 a.m. |
OK |
GNU C11 |
TESTS |
16 |
1577 |
4096000 |
|
|
263597542 |
tkddn5623 |
C |
June 1, 2024, 8:17 a.m. |
OK |
GNU C11 |
TESTS |
16 |
1577 |
4096000 |
|
|
263600558 |
tkddn5623 |
C |
June 1, 2024, 8:41 a.m. |
OK |
GNU C11 |
TESTS |
16 |
1609 |
3993600 |
|
|
263598063 |
tkddn5623 |
C |
June 1, 2024, 8:21 a.m. |
OK |
GNU C11 |
TESTS |
16 |
1718 |
4096000 |
|
|
263400320 |
79209748 |
C |
May 31, 2024, 2:33 a.m. |
OK |
Go |
TESTS |
16 |
139 |
81817600 |
|
|
263658099 |
nguyenquocthao00 |
C |
June 1, 2024, 4:40 p.m. |
OK |
Go |
TESTS |
16 |
405 |
112640000 |
|
|
263414255 |
coder0687 |
C |
May 31, 2024, 5:24 a.m. |
OK |
Java 21 |
TESTS |
16 |
359 |
19353600 |
|
|
263593656 |
adnan84 |
C |
June 1, 2024, 7:44 a.m. |
OK |
Java 21 |
TESTS |
16 |
452 |
11264000 |
|
|
263545474 |
shaili17 |
C |
May 31, 2024, 7:40 p.m. |
OK |
Java 21 |
TESTS |
16 |
453 |
10444800 |
|
|
263534625 |
SD125 |
C |
May 31, 2024, 5:42 p.m. |
OK |
Java 21 |
TESTS |
16 |
467 |
7475200 |
|
|
263589254 |
DAIICT_coder |
C |
June 1, 2024, 7:08 a.m. |
OK |
Java 21 |
TESTS |
16 |
468 |
7372800 |
|
|
263678661 |
mattr |
C |
June 1, 2024, 8:20 p.m. |
OK |
Java 21 |
TESTS |
16 |
468 |
10854400 |
|
|
263403998 |
Zhanzhe_Lee |
C |
May 31, 2024, 3:28 a.m. |
OK |
Java 21 |
TESTS |
16 |
483 |
7782400 |
|
|
263509287 |
abusaeed2433 |
C |
May 31, 2024, 2:06 p.m. |
OK |
Java 21 |
TESTS |
16 |
499 |
22528000 |
|
|
263520452 |
Althaf_Hussain |
C |
May 31, 2024, 3:38 p.m. |
OK |
Java 21 |
TESTS |
16 |
578 |
12595200 |
|
|
263538273 |
Sagy13 |
C |
May 31, 2024, 6:16 p.m. |
OK |
Java 21 |
TESTS |
16 |
593 |
24883200 |
|
|
263380862 |
Lakshay429 |
C |
May 30, 2024, 7:28 p.m. |
OK |
Java 8 |
TESTS |
16 |
296 |
0 |
|
|
263594839 |
abdulrahmanElfeky |
C |
June 1, 2024, 7:54 a.m. |
OK |
Java 8 |
TESTS |
16 |
327 |
15257600 |
|
|
263514582 |
jiminaseinen |
C |
May 31, 2024, 2:48 p.m. |
OK |
Java 8 |
TESTS |
16 |
343 |
18636800 |
|
|
263514315 |
jiminaseinen |
C |
May 31, 2024, 2:45 p.m. |
OK |
Java 8 |
TESTS |
16 |
358 |
18636800 |
|
|
263514183 |
hanekaeru |
C |
May 31, 2024, 2:44 p.m. |
OK |
Java 8 |
TESTS |
16 |
358 |
18636800 |
|
|
263384508 |
Blue_BEE |
C |
May 30, 2024, 8:22 p.m. |
OK |
Java 8 |
TESTS |
16 |
374 |
17408000 |
|
|
263433477 |
cai_lian_2023 |
C |
May 31, 2024, 8:02 a.m. |
OK |
Java 8 |
TESTS |
16 |
390 |
23347200 |
|
|
263551478 |
PassedPawn |
C |
May 31, 2024, 9:19 p.m. |
OK |
Java 8 |
TESTS |
16 |
405 |
32768000 |
|
|
263416881 |
ChongQY |
C |
May 31, 2024, 5:48 a.m. |
OK |
Java 8 |
TESTS |
16 |
452 |
23756800 |
|
|
263556936 |
alibaba |
C |
May 31, 2024, 11:36 p.m. |
OK |
Java 8 |
TESTS |
16 |
467 |
28364800 |
|
|
263406300 |
JeanExtreme002 |
C |
May 31, 2024, 3:58 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
968 |
56115200 |
|
|
263703938 |
17vineet |
C |
June 2, 2024, 5:45 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
983 |
26624000 |
|
|
263617050 |
baiganin |
C |
June 1, 2024, 10:57 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
1015 |
26624000 |
|
|
263567495 |
GOAT123 |
C |
June 1, 2024, 3:18 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
1015 |
26624000 |
|
|
263631822 |
kikjeck |
C |
June 1, 2024, 12:55 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
1030 |
27238400 |
|
|
263429158 |
lo_krlo_baatt |
C |
May 31, 2024, 7:27 a.m. |
OK |
PyPy 3 |
TESTS |
16 |
1046 |
25907200 |
|
|
263552298 |
CbFb |
C |
May 31, 2024, 9:37 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
1061 |
20377600 |
|
|
263380551 |
sushmanth.dampur8780 |
C |
May 30, 2024, 7:24 p.m. |
OK |
PyPy 3 |
TESTS |
16 |
1999 |
28262400 |
|
|
263641048 |
YMSeah |
C |
June 1, 2024, 2:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
218 |
33177600 |
|
|
263402296 |
smilences |
C |
May 31, 2024, 3:04 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
249 |
37068800 |
|
|
263526957 |
devjain1028 |
C |
May 31, 2024, 4:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
249 |
37888000 |
|
|
263410915 |
DeathbringerY |
C |
May 31, 2024, 4:51 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
249 |
43008000 |
|
|
263429823 |
deenium |
C |
May 31, 2024, 7:32 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
265 |
37888000 |
|
|
263584041 |
pennymagic156 |
C |
June 1, 2024, 6:25 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
280 |
32358400 |
|
|
263542473 |
sanctus |
C |
May 31, 2024, 7:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
280 |
34099200 |
|
|
263513310 |
shenge |
C |
May 31, 2024, 2:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
280 |
41984000 |
|
|
263593396 |
sohampalkar |
C |
June 1, 2024, 7:42 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
281 |
44851200 |
|
|
263400948 |
gche |
C |
May 31, 2024, 2:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
296 |
32870400 |
|
|
263571302 |
OLOGY |
C |
June 1, 2024, 4:04 a.m. |
OK |
Python 3 |
TESTS |
16 |
452 |
49459200 |
|
|
263570874 |
OLOGY |
C |
June 1, 2024, 3:59 a.m. |
OK |
Python 3 |
TESTS |
16 |
452 |
51097600 |
|
|
263678688 |
_Krishna_20_o2o |
C |
June 1, 2024, 8:21 p.m. |
OK |
Python 3 |
TESTS |
16 |
468 |
53043200 |
|
|
263598535 |
pennymagic156 |
C |
June 1, 2024, 8:25 a.m. |
OK |
Python 3 |
TESTS |
16 |
515 |
36454400 |
|
|
263636932 |
awesomep |
C |
June 1, 2024, 1:40 p.m. |
OK |
Python 3 |
TESTS |
16 |
515 |
49152000 |
|
|
263591167 |
nipun753 |
C |
June 1, 2024, 7:23 a.m. |
OK |
Python 3 |
TESTS |
16 |
624 |
36556800 |
|
|
263679890 |
__aniket |
C |
June 1, 2024, 8:40 p.m. |
OK |
Python 3 |
TESTS |
16 |
640 |
36454400 |
|
|
263629137 |
devansh_khandelwal |
C |
June 1, 2024, 12:30 p.m. |
OK |
Python 3 |
TESTS |
16 |
640 |
36454400 |
|
|
263610316 |
Aryansh_kr_1 |
C |
June 1, 2024, 10:03 a.m. |
OK |
Python 3 |
TESTS |
16 |
640 |
36454400 |
|
|
263608920 |
Hamza_Refai |
C |
June 1, 2024, 9:51 a.m. |
OK |
Python 3 |
TESTS |
16 |
640 |
36454400 |
|
|
263400941 |
fieubat2x |
C |
May 31, 2024, 2:44 a.m. |
OK |
Rust 2021 |
TESTS |
16 |
93 |
3993600 |
|
|
263555812 |
PlaceOrientedProgrammer |
C |
May 31, 2024, 11:07 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
93 |
4198400 |
|
|
263399887 |
fieubat2x |
C |
May 31, 2024, 2:25 a.m. |
OK |
Rust 2021 |
TESTS |
16 |
171 |
23142400 |
|
|
263601554 |
M1ngXu |
C |
June 1, 2024, 8:50 a.m. |
OK |
Rust 2021 |
TESTS |
16 |
202 |
14643200 |
|
|
263424696 |
DmitryLzr |
C |
May 31, 2024, 6:52 a.m. |
OK |
Rust 2021 |
TESTS |
16 |
218 |
21504000 |
|
|
263666885 |
Cheshulko |
C |
June 1, 2024, 5:58 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
233 |
16076800 |
|
|
remove filters
Back to search problems