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"On a strip of land of length n there are k air conditioners: the i -th air conditioner is placed in cell a_i ( 1 <= a_i <= n ). Two or more air conditioners cannot be placed in the same cell (i.e. all a_i are distinct). Each air conditioner is characterized by one parameter: temperature. The i -th air conditioner is set to the temperature t_i . For each cell i ( 1 <= i <= n ) find it's temperature, that can be calculated by the formula min_{1 <= j <= k}(t_j + |a_j - i|), where |a_j - i| denotes absolute value of the difference a_j - i . In other words, the temperature in cell i is equal to the minimum among the temperatures of air conditioners, increased by the distance from it to the cell i . Let's look at an example. Consider that n=6, k=2 , the first air conditioner is placed in cell a_1=2 and is set to the temperature t_1=14 and the second air conditioner is placed in cell a_2=5 and is set to the temperature t_2=16 . In that case temperatures in cells are: For each cell from 1 to n find the temperature in it. The first line contains one integer q ( 1 <= q <= 10^4 ) -- the number of test cases in the input. Then test cases follow. Before each test case, there is an empty line. Each test case contains three lines. The first line contains two integers n ( 1 <= n <= 3 cdot 10^5 ) and k ( 1 <= k <= n ) -- the length of the strip of land and the number of air conditioners respectively. The second line contains k integers a_1, a_2, ldots, a_k ( 1 <= a_i <= n ) -- positions of air conditioners on the strip of land. The third line contains k integers t_1, t_2, ldots, t_k ( 1 <= t_i <= 10^9 ) -- temperatures of air conditioners. It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case output"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
122013692 |
yycyyc |
E |
July 10, 2021, 6:38 p.m. |
OK |
GNU C11 |
TESTS |
7 |
1184 |
2457600 |
|
|
122036042 |
alex-lai |
E |
July 11, 2021, 4:44 a.m. |
OK |
GNU C11 |
TESTS |
31 |
1231 |
3584000 |
|
|
122025819 |
1435730 |
E |
July 11, 2021, 12:05 a.m. |
OK |
GNU C11 |
TESTS |
7 |
1247 |
3686400 |
|
|
122031347 |
Aditya_871 |
E |
July 11, 2021, 3:01 a.m. |
OK |
GNU C11 |
TESTS |
7 |
1247 |
4812800 |
|
|
122016386 |
lelouch-of-the-code |
E |
July 10, 2021, 7:20 p.m. |
OK |
GNU C11 |
TESTS |
7 |
1278 |
7168000 |
|
|
122032900 |
wangyuxianWBWYX |
E |
July 11, 2021, 3:35 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
108 |
3584000 |
|
|
122026103 |
sdfz171047 |
E |
July 11, 2021, 12:20 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
124 |
3379200 |
|
|
122016833 |
Rajib_119 |
E |
July 10, 2021, 7:27 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
124 |
4812800 |
|
|
122029346 |
Fman2018 |
E |
July 11, 2021, 2:12 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
124 |
6041600 |
|
|
122039538 |
Valour616 |
E |
July 11, 2021, 5:52 a.m. |
OK |
GNU C++11 |
TESTS |
31 |
124 |
6041600 |
|
|
121998825 |
EdisonBa |
E |
July 10, 2021, 4:44 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
156 |
4812800 |
|
|
121999236 |
chengchunhao |
E |
July 10, 2021, 4:45 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
171 |
4608000 |
|
|
122007180 |
shilezhi |
E |
July 10, 2021, 5:22 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
186 |
7168000 |
|
|
122002045 |
19Ztoa |
E |
July 10, 2021, 4:49 p.m. |
OK |
GNU C++11 |
TESTS |
7 |
186 |
17305600 |
|
|
122034058 |
Alie. |
E |
July 11, 2021, 3:59 a.m. |
OK |
GNU C++11 |
TESTS |
7 |
187 |
11980800 |
|
|
122026077 |
y0urs3lf |
E |
July 11, 2021, 12:18 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
202 |
4812800 |
|
|
122010500 |
kobebryan9 |
E |
July 10, 2021, 5:58 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
202 |
5529600 |
|
|
122001287 |
BlackDrago |
E |
July 10, 2021, 4:48 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
217 |
2355200 |
|
|
122003371 |
Mohtasim |
E |
July 10, 2021, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
217 |
3686400 |
|
|
122038805 |
anuj_deshmukh |
E |
July 11, 2021, 5:39 a.m. |
OK |
GNU C++14 |
TESTS |
31 |
217 |
4812800 |
|
|
122028466 |
chongyatu |
E |
July 11, 2021, 1:46 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
217 |
6041600 |
|
|
122033205 |
K-DA |
E |
July 11, 2021, 3:41 a.m. |
OK |
GNU C++14 |
TESTS |
7 |
217 |
7270400 |
|
|
122011659 |
john_28 |
E |
July 10, 2021, 6:12 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
218 |
3584000 |
|
|
122008435 |
kira0777 |
E |
July 10, 2021, 5:35 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
218 |
4812800 |
|
|
122010517 |
mango_kulfi |
E |
July 10, 2021, 5:58 p.m. |
OK |
GNU C++14 |
TESTS |
7 |
218 |
4812800 |
|
|
122001754 |
gslee |
E |
July 10, 2021, 4:49 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
2355200 |
|
|
122000638 |
thinn |
E |
July 10, 2021, 4:47 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
3584000 |
|
|
122007804 |
Turkhuuu |
E |
July 10, 2021, 5:28 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
3584000 |
|
|
122027945 |
yin12138 |
E |
July 11, 2021, 1:30 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
3584000 |
|
|
122028090 |
MaGnsi0 |
E |
July 11, 2021, 1:35 a.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
3584000 |
|
|
122004078 |
badlad |
E |
July 10, 2021, 4:58 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
4812800 |
|
|
122012873 |
Grapeee |
E |
July 10, 2021, 6:26 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
6041600 |
|
|
122005636 |
Tet |
E |
July 10, 2021, 5:09 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
202 |
36044800 |
|
|
122018952 |
shuvo_14 |
E |
July 10, 2021, 8:09 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
217 |
2355200 |
|
|
122014870 |
nik_kill |
E |
July 10, 2021, 6:56 p.m. |
OK |
GNU C++17 |
TESTS |
7 |
217 |
2355200 |
|
|
122006559 |
BERNARB.01 |
E |
July 10, 2021, 5:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
139 |
4812800 |
|
|
122009570 |
Akib_2612 |
E |
July 10, 2021, 5:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
139 |
4812800 |
|
|
122011229 |
RP_21 |
E |
July 10, 2021, 6:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
139 |
4812800 |
|
|
122021305 |
ultimate_pal |
E |
July 10, 2021, 9:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
139 |
4812800 |
|
|
122033555 |
thusloop |
E |
July 11, 2021, 3:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
139 |
7270400 |
|
|
121998601 |
status_coding |
E |
July 10, 2021, 4:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
140 |
2457600 |
|
|
122008719 |
khealer |
E |
July 10, 2021, 5:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
140 |
3584000 |
|
|
122018973 |
jainbot27 |
E |
July 10, 2021, 8:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
140 |
3584000 |
|
|
122030441 |
vineeth_kada |
E |
July 11, 2021, 2:39 a.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
140 |
6041600 |
|
|
122004211 |
Tsovak |
E |
July 10, 2021, 4:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
7 |
140 |
7270400 |
|
|
122005139 |
theanmolsharma |
E |
July 10, 2021, 5:05 p.m. |
OK |
Java 11 |
TESTS |
7 |
264 |
0 |
|
|
122013906 |
MrCodeRider |
E |
July 10, 2021, 6:41 p.m. |
OK |
Java 11 |
TESTS |
7 |
311 |
819200 |
|
|
122017614 |
ak_ankit |
E |
July 10, 2021, 7:41 p.m. |
OK |
Java 11 |
TESTS |
7 |
373 |
11980800 |
|
|
122007085 |
ab5v |
E |
July 10, 2021, 5:21 p.m. |
OK |
Java 11 |
TESTS |
7 |
374 |
12083200 |
|
|
122038176 |
nagu-pm |
E |
July 11, 2021, 5:27 a.m. |
OK |
Java 11 |
TESTS |
31 |
389 |
13209600 |
|
|
121999753 |
decoder_1671 |
E |
July 10, 2021, 4:46 p.m. |
OK |
Java 11 |
TESTS |
7 |
390 |
40243200 |
|
|
121998784 |
Sniper654 |
E |
July 10, 2021, 4:44 p.m. |
OK |
Java 11 |
TESTS |
7 |
405 |
11980800 |
|
|
122002869 |
DeepthansuGvs |
E |
July 10, 2021, 4:52 p.m. |
OK |
Java 11 |
TESTS |
7 |
405 |
14438400 |
|
|
122007839 |
ayush__1411 |
E |
July 10, 2021, 5:29 p.m. |
OK |
Java 11 |
TESTS |
7 |
436 |
11980800 |
|
|
122032055 |
EVTrainer bobbilyking |
E |
July 11, 2021, 3:16 a.m. |
OK |
Java 11 |
TESTS |
7 |
436 |
17100800 |
|
|
122021901 |
dexter_1205 |
E |
July 10, 2021, 9:26 p.m. |
OK |
Java 8 |
TESTS |
7 |
249 |
2662400 |
|
|
122000298 |
rohansingla07 |
E |
July 10, 2021, 4:47 p.m. |
OK |
Java 8 |
TESTS |
7 |
280 |
25395200 |
|
|
121999264 |
akshay23codes |
E |
July 10, 2021, 4:45 p.m. |
OK |
Java 8 |
TESTS |
7 |
296 |
25395200 |
|
|
122002138 |
pdk.abhishek |
E |
July 10, 2021, 4:49 p.m. |
OK |
Java 8 |
TESTS |
7 |
296 |
25907200 |
|
|
122008509 |
BruteForcee |
E |
July 10, 2021, 5:36 p.m. |
OK |
Java 8 |
TESTS |
7 |
296 |
26214400 |
|
|
122009231 |
nuni. |
E |
July 10, 2021, 5:44 p.m. |
OK |
Java 8 |
TESTS |
7 |
467 |
41676800 |
|
|
122019776 |
rahul_dce |
E |
July 10, 2021, 8:28 p.m. |
OK |
Java 8 |
TESTS |
7 |
514 |
69734400 |
|
|
122004120 |
jackiesteed |
E |
July 10, 2021, 4:58 p.m. |
OK |
Java 8 |
TESTS |
7 |
530 |
13619200 |
|
|
122005787 |
InANutshell |
E |
July 10, 2021, 5:10 p.m. |
OK |
Java 8 |
TESTS |
7 |
576 |
34304000 |
|
|
122035798 |
Dstoical |
E |
July 11, 2021, 4:39 a.m. |
OK |
Java 8 |
TESTS |
31 |
654 |
16179200 |
|
|
122005425 |
toommm |
E |
July 10, 2021, 5:07 p.m. |
OK |
Kotlin |
TESTS |
7 |
904 |
41984000 |
|
|
122030778 |
jrlqw |
E |
July 11, 2021, 2:48 a.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
280 |
4812800 |
|
|
122036475 |
dlehgns011 |
E |
July 11, 2021, 4:52 a.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
608 |
6144000 |
|
|
122020490 |
omar23_2 |
E |
July 10, 2021, 8:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
639 |
6451200 |
|
|
122011101 |
Tangerine |
E |
July 10, 2021, 6:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
639 |
14028800 |
|
|
122036528 |
dlehgns011 |
E |
July 11, 2021, 4:53 a.m. |
OK |
MS C++ 2017 |
TESTS |
31 |
655 |
10137600 |
|
|
122010441 |
Flyheck |
E |
July 10, 2021, 5:57 p.m. |
OK |
MS C++ 2017 |
TESTS |
7 |
670 |
14028800 |
|
|
122022892 |
tabibi |
E |
July 10, 2021, 10:01 p.m. |
OK |
.NET Core C# |
TESTS |
7 |
311 |
59494400 |
|
|
122003098 |
kakel_san |
E |
July 10, 2021, 4:53 p.m. |
OK |
.NET Core C# |
TESTS |
7 |
343 |
63385600 |
|
|
122014902 |
dufresne_1949 |
E |
July 10, 2021, 6:56 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
311 |
40140800 |
|
|
122025139 |
yash490 |
E |
July 10, 2021, 11:35 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
343 |
46489600 |
|
|
122022036 |
Aestroix |
E |
July 10, 2021, 9:30 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
404 |
241561600 |
|
|
122004161 |
rajbit |
E |
July 10, 2021, 4:59 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
561 |
43827200 |
|
|
122035716 |
not_tehlka |
E |
July 11, 2021, 4:37 a.m. |
OK |
PyPy 3 |
TESTS |
31 |
701 |
43622400 |
|
|
122026144 |
MILOY |
E |
July 11, 2021, 12:22 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
717 |
44544000 |
|
|
122024941 |
yash490 |
E |
July 10, 2021, 11:26 p.m. |
OK |
PyPy 3 |
TESTS |
7 |
733 |
46489600 |
|
|
122026352 |
h8191 |
E |
July 11, 2021, 12:31 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
795 |
47718400 |
|
|
122026282 |
h8191 |
E |
July 11, 2021, 12:28 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
826 |
46182400 |
|
|
122026309 |
h8191 |
E |
July 11, 2021, 12:30 a.m. |
OK |
PyPy 3 |
TESTS |
7 |
826 |
47718400 |
|
|
122018368 |
visheshg.co18 |
E |
July 10, 2021, 7:55 p.m. |
OK |
Python 3 |
TESTS |
7 |
997 |
31539200 |
|
|
122008166 |
nicola.bisetto |
E |
July 10, 2021, 5:33 p.m. |
OK |
Python 3 |
TESTS |
7 |
1029 |
31539200 |
|
|
122035349 |
shiviDON |
E |
July 11, 2021, 4:28 a.m. |
OK |
Python 3 |
TESTS |
31 |
1060 |
31744000 |
|
|
122011193 |
nk92292 |
E |
July 10, 2021, 6:06 p.m. |
OK |
Python 3 |
TESTS |
7 |
1107 |
31744000 |
|
|
122024964 |
supachai_pay |
E |
July 10, 2021, 11:28 p.m. |
OK |
Python 3 |
TESTS |
7 |
1169 |
48025600 |
|
|
122015036 |
dufresne_1949 |
E |
July 10, 2021, 6:58 p.m. |
OK |
Python 3 |
TESTS |
7 |
1200 |
37990400 |
|
|
122029932 |
hellohowareyou |
E |
July 11, 2021, 2:26 a.m. |
OK |
Python 3 |
TESTS |
7 |
1200 |
40038400 |
|
|
122023234 |
vinay272001 |
E |
July 10, 2021, 10:13 p.m. |
OK |
Python 3 |
TESTS |
7 |
1201 |
31539200 |
|
|
122009373 |
Skybytskyi.Nikita |
E |
July 10, 2021, 5:46 p.m. |
OK |
Python 3 |
TESTS |
7 |
1247 |
31539200 |
|
|
122004177 |
tempo001 |
E |
July 10, 2021, 4:59 p.m. |
OK |
Python 3 |
TESTS |
7 |
1747 |
72601600 |
|
|
remove filters
Back to search problems