Codeforces Round 896 (Div. 2)

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
1869 Codeforces Round 896 (Div. 2) FINISHED False 9000 42825263 Sept. 10, 2023, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 17200 ) B 2D Traveling PROGRAMMING geometry math shortest paths

B"Piggy lives on an infinite plane with the Cartesian coordinate system on it. There are n cities on the plane, numbered from 1 to n , and the first k cities are defined as major cities. The coordinates of the i -th city are (x_i,y_i) . Piggy, as a well-experienced traveller, wants to have a relaxing trip after Zhongkao examination. Currently, he is in city a , and he wants to travel to city b by air. You can fly between any two cities, and you can visit several cities in any order while travelling, but the final destination must be city b . Because of active trade between major cities, it's possible to travel by plane between them for free. Formally, the price of an air ticket f(i,j) between two cities i and j is defined as follows: f(i,j)= begin{cases} 0, & text{if cities }i text{ and }j text{ are both major cities} |x_i-x_j|+|y_i-y_j|, & text{otherwise} end{cases} Piggy doesn't want to save time, but he wants to save money. So you need to tell him the minimum value of the total cost of all air tickets if he can take any number of flights. The first line of input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains four integers n , k , a and b ( 2 <= n <= 2 cdot 10^5 , 0 <= k <= n , 1 <= a,b <= n , a ne b ) -- the number of cities, the number of major cities and the numbers of the starting and the ending cities. Then n lines follow, the i -th line contains two integers x_i and y_i ( -10^9 <= x_i,y_i <= 10^9 ) -- the coordinates of the i -th city. The first k lines describe major cities. It is guaranteed that all coordinates are pairwise distinct. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print a single"...

Tutorials

Codeforces Round 896 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
222808903 iffatul_anon B Sept. 10, 2023, 5:23 p.m. OK GNU C11 TESTS 16 124 3174400
222807789 iffatul_anon B Sept. 10, 2023, 5:17 p.m. OK GNU C11 TESTS 16 124 3174400
222804042 shiqi798. B Sept. 10, 2023, 4:33 p.m. OK GNU C11 TESTS 16 140 3174400
222797144 fugah271202 B Sept. 10, 2023, 4:17 p.m. OK GNU C11 TESTS 16 155 3174400
222841843 huanghongye B Sept. 11, 2023, 1:26 a.m. OK GNU C++14 TESTS 16 124 1638400
222824573 omeganot B Sept. 10, 2023, 7:37 p.m. OK GNU C++14 TESTS 16 124 1638400
222839633 Junz_LJL B Sept. 11, 2023, 12:37 a.m. OK GNU C++14 TESTS 16 124 3174400
222839577 trh0630 B Sept. 11, 2023, 12:36 a.m. OK GNU C++14 TESTS 16 124 3174400
222838551 kkksa01 B Sept. 11, 2023, 12:10 a.m. OK GNU C++14 TESTS 16 124 3174400
222800426 grogu_ B Sept. 10, 2023, 4:25 p.m. OK GNU C++14 TESTS 16 124 3174400
222842504 tyWu B Sept. 11, 2023, 1:40 a.m. OK GNU C++14 TESTS 16 124 3174400
222843284 Zhao_Xudong B Sept. 11, 2023, 1:57 a.m. OK GNU C++14 TESTS 16 124 3174400
222850186 witcherOz B Sept. 11, 2023, 4:12 a.m. OK GNU C++14 TESTS 16 124 3174400
222855680 lpnp6 B Sept. 11, 2023, 5:37 a.m. OK GNU C++14 TESTS 16 124 3174400
222846998 wxy2010 B Sept. 11, 2023, 3:12 a.m. OK GNU C++17 TESTS 16 108 1638400
222846257 MdAbedin B Sept. 11, 2023, 2:57 a.m. OK GNU C++17 TESTS 16 124 1638400
222840895 JIM_54 B Sept. 11, 2023, 1:05 a.m. OK GNU C++17 TESTS 16 124 1638400
222837592 GM0000 B Sept. 10, 2023, 11:41 p.m. OK GNU C++17 TESTS 16 124 1638400
222836733 sahmanojkumar1976 B Sept. 10, 2023, 11:15 p.m. OK GNU C++17 TESTS 16 124 1638400
222831153 ahmedyoussefg B Sept. 10, 2023, 9:06 p.m. OK GNU C++17 TESTS 16 124 1638400
222847278 ananthak B Sept. 11, 2023, 3:17 a.m. OK GNU C++17 TESTS 16 124 1638400
222850289 Noob-Boy B Sept. 11, 2023, 4:14 a.m. OK GNU C++17 TESTS 16 124 1638400
222849497 conexposys B Sept. 11, 2023, 4:01 a.m. OK GNU C++17 TESTS 16 124 1638400
222849113 Osho_Rajneesh B Sept. 11, 2023, 3:54 a.m. OK GNU C++17 TESTS 16 124 1638400
222840834 wsyear B Sept. 11, 2023, 1:04 a.m. OK GNU C++17 (64) TESTS 16 77 3174400
222835417 Zhak_RMukh B Sept. 10, 2023, 10:39 p.m. OK GNU C++17 (64) TESTS 16 78 3174400
222837465 Sa7afy22 B Sept. 10, 2023, 11:37 p.m. OK GNU C++17 (64) TESTS 16 78 3481600
222846502 Capps B Sept. 11, 2023, 3:02 a.m. OK GNU C++17 (64) TESTS 16 92 1638400
222840891 ftt2333 B Sept. 11, 2023, 1:05 a.m. OK GNU C++17 (64) TESTS 16 92 3174400
222837959 akwa_blue B Sept. 10, 2023, 11:52 p.m. OK GNU C++17 (64) TESTS 16 93 1638400
222845862 ZXG_DZXX B Sept. 11, 2023, 2:48 a.m. OK GNU C++17 (64) TESTS 16 93 3174400
222850119 MUNISJONI_KHURSHEDJON B Sept. 11, 2023, 4:11 a.m. OK GNU C++17 (64) TESTS 16 93 3174400
222852601 Coldmou4 B Sept. 11, 2023, 4:52 a.m. OK GNU C++17 (64) TESTS 16 93 3174400
222852868 Alfa B Sept. 11, 2023, 4:56 a.m. OK GNU C++17 (64) TESTS 16 93 3174400
222854297 The-Fourth-Pole B Sept. 11, 2023, 5:16 a.m. OK GNU C++20 (64) TESTS 16 31 1638400
222840725 cmk666 B Sept. 11, 2023, 1:01 a.m. OK GNU C++20 (64) TESTS 16 31 3686400
222830036 0x81 B Sept. 10, 2023, 8:48 p.m. OK GNU C++20 (64) TESTS 16 31 42188800
222847626 Nekura_Yuki B Sept. 11, 2023, 3:23 a.m. OK GNU C++20 (64) TESTS 16 62 1638400
222845221 Tang2 B Sept. 11, 2023, 2:35 a.m. OK GNU C++20 (64) TESTS 16 62 1638400
222808883 balabalabala_ B Sept. 10, 2023, 5:22 p.m. OK GNU C++20 (64) TESTS 16 62 1638400
222849883 vmsreeram B Sept. 11, 2023, 4:07 a.m. OK GNU C++20 (64) TESTS 16 62 1638400
222848242 i_emerge16 B Sept. 11, 2023, 3:36 a.m. OK GNU C++20 (64) TESTS 16 62 1638400
222848065 i_emerge16 B Sept. 11, 2023, 3:33 a.m. OK GNU C++20 (64) TESTS 16 62 1638400
222853702 youngr B Sept. 11, 2023, 5:08 a.m. OK GNU C++20 (64) TESTS 16 62 1638400
222826399 ahmad.mhmd.sakr B Sept. 10, 2023, 7:59 p.m. OK Go TESTS 16 218 7577600
222809147 Platinumda B Sept. 10, 2023, 5:24 p.m. OK Go TESTS 16 249 7884800
222856861 katomasao B Sept. 11, 2023, 5:52 a.m. OK Haskell TESTS 16 265 53555200
222841023 Daniel112 B Sept. 11, 2023, 1:08 a.m. OK Java 11 TESTS 16 265 0
222840170 ahmed_labib B Sept. 11, 2023, 12:48 a.m. OK Java 11 TESTS 16 311 5222400
222828299 pakkapapad B Sept. 10, 2023, 8:24 p.m. OK Java 11 TESTS 16 342 5222400
222798449 dark_knight_5656 B Sept. 10, 2023, 4:20 p.m. OK Java 11 TESTS 16 343 0
222796340 Dream-On B Sept. 10, 2023, 4:15 p.m. OK Java 11 TESTS 16 343 5529600
222828014 itssocialkks B Sept. 10, 2023, 8:20 p.m. OK Java 11 TESTS 16 358 2969600
222808048 Barbareek_3 B Sept. 10, 2023, 5:18 p.m. OK Java 11 TESTS 16 374 3788800
222816024 imprakharzz B Sept. 10, 2023, 6:15 p.m. OK Java 11 TESTS 16 374 5324800
222816930 creativegiant B Sept. 10, 2023, 6:22 p.m. OK Java 11 TESTS 16 436 2969600
222814785 shivanshu_100 B Sept. 10, 2023, 6:05 p.m. OK Java 11 TESTS 16 810 0
222842213 Ligh0x74 B Sept. 11, 2023, 1:34 a.m. OK Java 17 TESTS 16 327 614400
222842283 Ligh0x74 B Sept. 11, 2023, 1:36 a.m. OK Java 17 TESTS 16 342 614400
222801556 jasonkaixie B Sept. 10, 2023, 4:28 p.m. OK Java 17 TESTS 16 343 6246400
222855960 sergey.chistofor B Sept. 11, 2023, 5:41 a.m. OK Java 17 TESTS 16 358 614400
222831961 _ryan18_ B Sept. 10, 2023, 9:21 p.m. OK Java 17 TESTS 16 358 3686400
222835202 mangos194 B Sept. 10, 2023, 10:33 p.m. OK Java 17 TESTS 16 373 614400
222803699 sahil.dhiman03022001 B Sept. 10, 2023, 4:32 p.m. OK Java 17 TESTS 16 374 6963200
222814481 vaibhav_1710 B Sept. 10, 2023, 6:02 p.m. OK Java 17 TESTS 16 374 14028800
222846105 ShresCodes B Sept. 11, 2023, 2:53 a.m. OK Java 17 TESTS 16 421 15564800
222799505 hamossa B Sept. 10, 2023, 4:23 p.m. OK Java 17 TESTS 16 436 6348800
222801894 Gaddi_Gang B Sept. 10, 2023, 4:29 p.m. OK Java 8 TESTS 16 234 0
222799474 Yousef_Badr B Sept. 10, 2023, 4:23 p.m. OK Java 8 TESTS 16 265 4198400
222847744 harry1995 B Sept. 11, 2023, 3:26 a.m. OK Java 8 TESTS 16 295 4505600
222818194 Sumitsingh7 B Sept. 10, 2023, 6:32 p.m. OK Java 8 TESTS 16 295 4812800
222828685 athenaseye B Sept. 10, 2023, 8:29 p.m. OK Java 8 TESTS 16 342 15564800
222852558 amit_roy B Sept. 11, 2023, 4:51 a.m. OK Java 8 TESTS 16 748 5734400
222796776 dhruvtanwar B Sept. 10, 2023, 4:16 p.m. OK Java 8 TESTS 16 764 1331200
222847416 icebean B Sept. 11, 2023, 3:19 a.m. OK Java 8 TESTS 16 795 0
222854292 krishank08eng B Sept. 11, 2023, 5:16 a.m. OK Java 8 TESTS 16 811 2252800
222811635 eXav B Sept. 10, 2023, 5:40 p.m. OK MS C++ 2017 TESTS 16 483 4812800
222799328 yym1617518805 B Sept. 10, 2023, 4:22 p.m. OK MS C++ 2017 TESTS 16 498 3174400
222824109 jvatsal0709 B Sept. 10, 2023, 7:32 p.m. OK PyPy 3 TESTS 16 967 18022400
222807184 krishna122356 B Sept. 10, 2023, 5:14 p.m. OK PyPy 3 TESTS 16 982 11673600
222809191 Z_actuary B Sept. 10, 2023, 5:24 p.m. OK PyPy 3-64 TESTS 16 374 16691200
222852966 kamirden B Sept. 11, 2023, 4:58 a.m. OK PyPy 3-64 TESTS 16 389 16896000
222825015 whatshisbucket B Sept. 10, 2023, 7:42 p.m. OK PyPy 3-64 TESTS 16 405 30924800
222818651 konjac12345 B Sept. 10, 2023, 6:36 p.m. OK PyPy 3-64 TESTS 16 420 31232000
222800752 IwiG B Sept. 10, 2023, 4:26 p.m. OK PyPy 3-64 TESTS 16 421 19968000
222808597 AAE B Sept. 10, 2023, 5:21 p.m. OK PyPy 3-64 TESTS 16 452 33484800
222845458 giriraj_parik B Sept. 11, 2023, 2:40 a.m. OK PyPy 3-64 TESTS 16 467 18944000
222833847 RobinFromTheHood B Sept. 10, 2023, 10 p.m. OK PyPy 3-64 TESTS 16 467 34713600
222840496 JinYuManTang B Sept. 11, 2023, 12:55 a.m. OK PyPy 3-64 TESTS 16 482 28876800
222820761 ganta.jashu B Sept. 10, 2023, 6:56 p.m. OK PyPy 3-64 TESTS 16 498 21708800
222827129 rtbolt B Sept. 10, 2023, 8:08 p.m. OK Python 3 TESTS 16 451 16179200
222824885 daszybak B Sept. 10, 2023, 7:41 p.m. OK Python 3 TESTS 16 451 40140800
222844564 ProCoder12 B Sept. 11, 2023, 2:22 a.m. OK Python 3 TESTS 16 467 18636800
222845332 h.sakamoto B Sept. 11, 2023, 2:37 a.m. OK Python 3 TESTS 16 467 32051200
222841970 pennymagic156 B Sept. 11, 2023, 1:29 a.m. OK Python 3 TESTS 16 499 43008000
222827747 alexpods B Sept. 10, 2023, 8:16 p.m. OK Python 3 TESTS 16 545 39628800
222827211 alexpods B Sept. 10, 2023, 8:09 p.m. OK Python 3 TESTS 16 560 47104000
222826990 alexpods B Sept. 10, 2023, 8:06 p.m. OK Python 3 TESTS 16 561 46182400
222826707 alexpods B Sept. 10, 2023, 8:03 p.m. OK Python 3 TESTS 16 561 46182400
222822482 bronze_coder B Sept. 10, 2023, 7:15 p.m. OK Python 3 TESTS 16 607 28467200

remove filters

Back to search problems