Codeforces Round 891 (Div. 3)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1857 Codeforces Round 891 (Div. 3) FINISHED False 8100 45761063 Aug. 7, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12940 ) E Power of Points PROGRAMMING math sortings

B'You are given n points with integer coordinates x_1, ... x_n , which lie on a number line. For some integer s , we construct segments [ s,x_1 ], [ s,x_2 ], ... , [ s,x_n ]. Note that if x_i<s , then the segment will look like [ x_i,s ]. The segment [ a, b ] covers all integer points a, a+1, a+2, ... , b . We define the power of a point p as the number of segments that intersect the point with coordinate p , denoted as f_p . Your task is to compute sum limits_{p=1}^{10^9}f_p for each s in {x_1, ... ,x_n } , i.e., the sum of f_p for all integer points from 1 to 10^9 . For example, if the initial coordinates are [1,2,5,7,1] and we choose s=5 , then the segments will be: [1,5] , [2,5] , [5,5] , [5,7] , [1,5] . And the powers of the points will be: f_1=2, f_2=3, f_3=3, f_4=3, f_5=5, f_6=1, f_7=1, f_8=0, ... , f_{10^9}=0 . Their sum is 2+3+3+3+5+1+1=18 . The first line contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains an integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of points. The second line contains n integers x_1,x_2 ... x_n ( 1 <= x_i <= 10^9 ) -- the coordinates of the points. It is guaranteed that the sum of the values of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output n integers, where the i -th integer is equal to the sum of the powers of all points for s=x_i . In the first test case we first choose s=x_1=1 , then the following segments are formed: [1,1] , [1,4] , [1,3] . The powers of the points will be as follows: f_1=3, f_2=2, f_3=2, f_4=1, f_5=0 ... The sum of powers of the points: 3+2+2+1+0+ ... +0=8 . After that we choose s=x_2=4 . Then there will be such segments: [1,4] , [4,4] , [3,4] '...

Tutorials

119134

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
217800893 tahtarovserver E Aug. 8, 2023, 3:43 a.m. OK C# 10 TESTS 11 171 51609600
217753347 NenadDapic E Aug. 7, 2023, 6:22 p.m. OK FPC TESTS 11 654 6451200
217753240 NenadDapic E Aug. 7, 2023, 6:21 p.m. OK FPC TESTS 11 654 6451200
217777099 1435730 E Aug. 8, 2023, 12:33 a.m. OK GNU C11 TESTS 11 1060 4812800
217782219 ScottSuperb E Aug. 8, 2023, 1:48 a.m. OK GNU C++14 TESTS 11 93 5324800
217782965 zhangzhimo E Aug. 8, 2023, 1:56 a.m. OK GNU C++14 TESTS 11 93 21606400
217805074 halothez E Aug. 8, 2023, 4:35 a.m. OK GNU C++14 TESTS 11 139 3993600
217797737 dxm E Aug. 8, 2023, 3:08 a.m. OK GNU C++14 TESTS 11 155 3174400
217806784 jatinxkirito E Aug. 8, 2023, 4:56 a.m. OK GNU C++14 TESTS 11 155 3174400
217799854 codeforces_pupil E Aug. 8, 2023, 3:31 a.m. OK GNU C++14 TESTS 11 155 4812800
217773675 conexposys E Aug. 7, 2023, 11:11 p.m. OK GNU C++14 TESTS 11 155 5632000
217774967 itsQuang E Aug. 7, 2023, 11:45 p.m. OK GNU C++14 TESTS 11 155 6451200
217774630 underkill E Aug. 7, 2023, 11:36 p.m. OK GNU C++14 TESTS 11 155 6451200
217797204 SuperBeau E Aug. 8, 2023, 3:02 a.m. OK GNU C++14 TESTS 11 155 6451200
217755471 EternityPure E Aug. 7, 2023, 6:40 p.m. OK GNU C++17 TESTS 11 124 4812800
217763860 CSHwang E Aug. 7, 2023, 8:01 p.m. OK GNU C++17 TESTS 11 139 4812800
217742793 pipi0818 E Aug. 7, 2023, 5:13 p.m. OK GNU C++17 TESTS 11 139 6451200
217787015 szdytom E Aug. 8, 2023, 2:42 a.m. OK GNU C++17 TESTS 11 140 3174400
217804133 hyyw051228 E Aug. 8, 2023, 4:22 a.m. OK GNU C++17 TESTS 11 140 6451200
217811998 fll E Aug. 8, 2023, 5:52 a.m. OK GNU C++17 TESTS 11 155 3993600
217774921 Nolv E Aug. 7, 2023, 11:44 p.m. OK GNU C++17 TESTS 11 155 4812800
217805203 lsh_algorithm E Aug. 8, 2023, 4:37 a.m. OK GNU C++17 TESTS 11 155 4812800
217781565 Charming E Aug. 8, 2023, 1:40 a.m. OK GNU C++17 TESTS 11 155 4812800
217763178 ashishkumarrkt15 E Aug. 7, 2023, 7:53 p.m. OK GNU C++17 TESTS 11 155 4812800
217778435 ccds E Aug. 8, 2023, 12:59 a.m. OK GNU C++17 (64) TESTS 11 93 3174400
217810233 CN__james1 E Aug. 8, 2023, 5:34 a.m. OK GNU C++17 (64) TESTS 11 93 3174400
217787323 Joe_yue6 E Aug. 8, 2023, 2:46 a.m. OK GNU C++17 (64) TESTS 11 93 4812800
217786110 RGB_YYYYY E Aug. 8, 2023, 2:32 a.m. OK GNU C++17 (64) TESTS 11 93 4812800
217781836 LXH-cat E Aug. 8, 2023, 1:44 a.m. OK GNU C++17 (64) TESTS 11 93 4812800
217774150 enslaved E Aug. 7, 2023, 11:22 p.m. OK GNU C++17 (64) TESTS 11 93 4812800
217773538 Hytidel E Aug. 7, 2023, 11:08 p.m. OK GNU C++17 (64) TESTS 11 93 4812800
217763070 sahibsingh139 E Aug. 7, 2023, 7:52 p.m. OK GNU C++17 (64) TESTS 11 93 4812800
217787543 wuzihan E Aug. 8, 2023, 2:49 a.m. OK GNU C++17 (64) TESTS 11 93 4812800
217786211 vegeone E Aug. 8, 2023, 2:33 a.m. OK GNU C++17 (64) TESTS 11 93 6451200
217779463 cmk666 E Aug. 8, 2023, 1:13 a.m. OK GNU C++20 (64) TESTS 11 46 6963200
217753287 ishwarendra E Aug. 7, 2023, 6:21 p.m. OK GNU C++20 (64) TESTS 11 61 4812800
217759945 tvw E Aug. 7, 2023, 7:20 p.m. OK GNU C++20 (64) TESTS 11 61 4812800
217758059 kira_lite E Aug. 7, 2023, 7:03 p.m. OK GNU C++20 (64) TESTS 11 61 4812800
217802595 Anti-Python E Aug. 8, 2023, 4:03 a.m. OK GNU C++20 (64) TESTS 11 61 8499200
217799552 ankeet E Aug. 8, 2023, 3:28 a.m. OK GNU C++20 (64) TESTS 11 62 3174400
217779819 PSG.LGD.fy E Aug. 8, 2023, 1:18 a.m. OK GNU C++20 (64) TESTS 11 62 3174400
217741826 Sai-17 E Aug. 7, 2023, 5:08 p.m. OK GNU C++20 (64) TESTS 11 62 3174400
217804122 eternal_happiness E Aug. 8, 2023, 4:22 a.m. OK GNU C++20 (64) TESTS 11 62 4812800
217812172 zzq123 E Aug. 8, 2023, 5:53 a.m. OK GNU C++20 (64) TESTS 11 62 4812800
217743728 j.s.cheng E Aug. 7, 2023, 5:17 p.m. OK Go TESTS 11 202 16691200
217800783 henrychenOutlook E Aug. 8, 2023, 3:41 a.m. OK Java 11 TESTS 11 327 2867200
217744384 sushibob E Aug. 7, 2023, 5:21 p.m. OK Java 11 TESTS 11 343 14131200
217778305 Edge_Tree E Aug. 8, 2023, 12:57 a.m. OK Java 11 TESTS 11 358 40550400
217759779 Panther369 E Aug. 7, 2023, 7:19 p.m. OK Java 11 TESTS 11 405 14540800
217747310 chunqiu.ssh E Aug. 7, 2023, 5:39 p.m. OK Java 11 TESTS 11 1029 3993600
217760900 PlayDate E Aug. 7, 2023, 7:30 p.m. OK Java 11 TESTS 11 1294 18636800
217761216 PlayDate E Aug. 7, 2023, 7:33 p.m. OK Java 11 TESTS 11 1450 18841600
217743241 Eslam_Ahmed E Aug. 7, 2023, 5:15 p.m. OK Java 17 TESTS 11 342 6348800
217749534 optimus1369 E Aug. 7, 2023, 5:54 p.m. OK Java 17 TESTS 11 374 8089600
217746539 Pratham2908 E Aug. 7, 2023, 5:34 p.m. OK Java 17 TESTS 11 436 19865600
217743251 Pratham2908 E Aug. 7, 2023, 5:15 p.m. OK Java 17 TESTS 11 436 20480000
217745224 Pratham2908 E Aug. 7, 2023, 5:26 p.m. OK Java 17 TESTS 11 467 19456000
217778246 InfinitePath E Aug. 8, 2023, 12:56 a.m. OK Java 17 TESTS 11 467 60416000
217807945 Icpc_811 E Aug. 8, 2023, 5:09 a.m. OK Java 17 TESTS 11 514 37785600
217742210 char321 E Aug. 7, 2023, 5:10 p.m. OK Java 17 TESTS 11 545 25292800
217798361 not_just_rr E Aug. 8, 2023, 3:14 a.m. OK Java 17 TESTS 11 545 38604800
217774862 yousef03 E Aug. 7, 2023, 11:42 p.m. OK Java 17 TESTS 11 686 44646400
217796649 chuquwan9964 E Aug. 8, 2023, 2:57 a.m. OK Java 8 TESTS 11 311 0
217765820 shabashoff E Aug. 7, 2023, 8:25 p.m. OK Java 8 TESTS 11 639 22425600
217784622 NimiSora E Aug. 8, 2023, 2:16 a.m. OK Java 8 TESTS 11 748 22323200
217800380 JavaGodPeter E Aug. 8, 2023, 3:37 a.m. OK Java 8 TESTS 11 1340 18124800
217741396 dylan1006498 E Aug. 7, 2023, 5:06 p.m. OK PyPy 3 TESTS 11 811 33382400
217749663 Imeon E Aug. 7, 2023, 5:54 p.m. OK PyPy 3 TESTS 11 1388 46592000
217749592 Imeon E Aug. 7, 2023, 5:54 p.m. OK PyPy 3 TESTS 11 1559 46489600
217749633 person_exe E Aug. 7, 2023, 5:54 p.m. OK PyPy 3-64 TESTS 11 249 33382400
217758415 the_last_smilodon E Aug. 7, 2023, 7:06 p.m. OK PyPy 3-64 TESTS 11 265 33484800
217751878 Alex239 E Aug. 7, 2023, 6:10 p.m. OK PyPy 3-64 TESTS 11 343 32768000
217748091 Nabeel_Ismaeel E Aug. 7, 2023, 5:44 p.m. OK PyPy 3-64 TESTS 11 358 60416000
217775047 Dert30 E Aug. 7, 2023, 11:48 p.m. OK PyPy 3-64 TESTS 11 373 34611200
217751344 patta.gobhi E Aug. 7, 2023, 6:07 p.m. OK PyPy 3-64 TESTS 11 374 39731200
217780296 okay4869 E Aug. 8, 2023, 1:24 a.m. OK PyPy 3-64 TESTS 11 421 27648000
217747990 aayush_chhabra E Aug. 7, 2023, 5:43 p.m. OK PyPy 3-64 TESTS 11 421 34816000
217750603 gardengnome E Aug. 7, 2023, 6:01 p.m. OK PyPy 3-64 TESTS 11 436 29081600
217800572 Mohamed_Hamed E Aug. 8, 2023, 3:39 a.m. OK PyPy 3-64 TESTS 11 451 31846400
217763045 skatiyar236 E Aug. 7, 2023, 7:52 p.m. OK Python 3 TESTS 11 639 47923200
217800611 ZhewenYu E Aug. 8, 2023, 3:39 a.m. OK Python 3 TESTS 11 779 53043200
217801922 smqdcf E Aug. 8, 2023, 3:55 a.m. OK Python 3 TESTS 11 1091 47923200
217758217 BananaHead E Aug. 7, 2023, 7:04 p.m. OK Python 3 TESTS 11 1325 80691200
217748352 ihnaqi E Aug. 7, 2023, 5:46 p.m. OK Rust 2021 TESTS 11 108 13721600
217747441 ihnaqi E Aug. 7, 2023, 5:40 p.m. OK Rust 2021 TESTS 11 108 13721600

remove filters

Back to search problems