Codeforces Round 788 (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
1670 Codeforces Round 788 (Div. 2) FINISHED False 7200 85332263 May 6, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10152 ) C Where is the Pizza? PROGRAMMING data structures dfs and similar ds graphs implementation math 1400

B'While searching for the pizza, baby Hosssam came across two permutations a and b of length n . Recall that a permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array) and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). Baby Hosssam forgot about the pizza and started playing around with the two permutations. While he was playing with them, some elements of the first permutation got mixed up with some elements of the second permutation, and to his surprise those elements also formed a permutation of size n . Specifically, he mixed up the permutations to form a new array c in the following way. You know permutations a , b , and values at some positions in c . Please count the number different permutations c that are consistent with the described process and the given values. Since the answer can be large, print it modulo 10^9+7 . It is guaranteed that there exists at least one permutation c that satisfies all the requirements. The first line contains an integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the permutations. The next line contains n distinct integers a_1,a_2, ldots,a_n ( 1 <= a_i <= n ) -- the first permutation. The next line contains n distinct integers b_1,b_2, ldots,b_n ( 1 <= b_i <= n ) -- the second permutation. The next line contains n distinct integers d_1,d_2, ldots,d_n ( d_i is either 0 , a_i , or b_i ) -- the description of the known values of c . If d_i=0 , then there are no requirements on the value of c_i . Otherwise, it is required that c_i=d_i . It is '...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
156160839 extremall C May 7, 2022, 5:31 a.m. OK C# 8 TESTS 24 686 16588800 1400
156125197 1435730 C May 6, 2022, 5:32 p.m. OK GNU C11 TESTS 23 61 2355200 1400
156125069 keshavgupta06 C May 6, 2022, 5:31 p.m. OK GNU C11 TESTS 23 171 1638400 1400
156131810 YOK C May 6, 2022, 6:39 p.m. OK GNU C11 TESTS 23 171 1740800 1400
156110000 yooyou7 C May 6, 2022, 3:53 p.m. OK GNU C11 TESTS 23 171 2048000 1400
156130586 dougn711 C May 6, 2022, 6:24 p.m. OK GNU C11 TESTS 23 171 5017600 1400
156149998 CQYZWJH C May 7, 2022, 1:54 a.m. OK GNU C++14 TESTS 24 31 2150400 1400
156117087 Godwinner C May 6, 2022, 4:18 p.m. OK GNU C++14 TESTS 23 31 4505600 1400
156111277 liuyaningqwq C May 6, 2022, 3:57 p.m. OK GNU C++14 TESTS 23 62 3072000 1400
156147712 liympanda C May 7, 2022, 12:48 a.m. OK GNU C++14 TESTS 24 62 3993600 1400
156153866 duoluoluo C May 7, 2022, 3:18 a.m. OK GNU C++14 TESTS 24 62 4915200 1400
156151938 Hush C May 7, 2022, 2:38 a.m. OK GNU C++14 TESTS 24 62 8704000 1400
156146642 euphria C May 7, 2022, 12:10 a.m. OK GNU C++14 TESTS 24 77 1843200 1400
156113907 qzhwlzy C May 6, 2022, 4:06 p.m. OK GNU C++14 TESTS 23 77 8499200 1400
156147166 lzy2021 C May 7, 2022, 12:30 a.m. OK GNU C++14 TESTS 24 78 1228800 1400
156112595 meyi C May 6, 2022, 4:01 p.m. OK GNU C++14 TESTS 23 78 1433600 1400
156110007 zhangpangpang C May 6, 2022, 3:53 p.m. OK GNU C++17 TESTS 23 46 4812800 1400
156148210 jhc_123 C May 7, 2022, 1:05 a.m. OK GNU C++17 TESTS 24 46 18534400 1400
156150667 tyang C May 7, 2022, 2:10 a.m. OK GNU C++17 TESTS 24 62 1843200 1400
156138926 Mahm2od C May 6, 2022, 8:24 p.m. OK GNU C++17 TESTS 23 62 2048000 1400
156114245 Ice_teapoy C May 6, 2022, 4:07 p.m. OK GNU C++17 TESTS 23 62 2355200 1400
156111681 Viva_lemon C May 6, 2022, 3:58 p.m. OK GNU C++17 TESTS 23 62 5632000 1400
156115286 huang_cc C May 6, 2022, 4:11 p.m. OK GNU C++17 TESTS 23 77 2150400 1400
156117768 AcqingX C May 6, 2022, 4:20 p.m. OK GNU C++17 TESTS 23 77 2662400 1400
156151390 fctee C May 7, 2022, 2:27 a.m. OK GNU C++17 TESTS 24 77 4812800 1400
156135976 arn200 C May 6, 2022, 7:35 p.m. OK GNU C++17 TESTS 23 77 5017600 1400
156119488 houghstc C May 6, 2022, 4:27 p.m. OK GNU C++17 (64) TESTS 23 46 1228800 1400
156154894 xuqijie C May 7, 2022, 3:38 a.m. OK GNU C++17 (64) TESTS 24 46 1638400 1400
156135035 Havoc_01 C May 6, 2022, 7:21 p.m. OK GNU C++17 (64) TESTS 23 46 1638400 1400
156112666 AbdalrhmanEssam C May 6, 2022, 4:02 p.m. OK GNU C++17 (64) TESTS 23 46 1638400 1400
156151997 jiajieshi C May 7, 2022, 2:39 a.m. OK GNU C++17 (64) TESTS 24 46 1843200 1400
156129698 kessido C May 6, 2022, 6:14 p.m. OK GNU C++17 (64) TESTS 23 46 2048000 1400
156134801 Havoc_01 C May 6, 2022, 7:17 p.m. OK GNU C++17 (64) TESTS 23 46 2048000 1400
156119114 wrc C May 6, 2022, 4:25 p.m. OK GNU C++17 (64) TESTS 23 46 2048000 1400
156109526 heaksicn C May 6, 2022, 3:52 p.m. OK GNU C++17 (64) TESTS 23 46 2048000 1400
156149679 KevinSo25 C May 7, 2022, 1:46 a.m. OK GNU C++17 (64) TESTS 24 46 2150400 1400
156156565 not_alone C May 7, 2022, 4:12 a.m. OK GNU C++20 (64) TESTS 24 31 2457600 1400
156159558 guoziyue C May 7, 2022, 5:10 a.m. OK GNU C++20 (64) TESTS 24 46 1228800 1400
156115856 Nakamiya C May 6, 2022, 4:13 p.m. OK GNU C++20 (64) TESTS 23 46 1638400 1400
156114093 Dhafin C May 6, 2022, 4:07 p.m. OK GNU C++20 (64) TESTS 23 46 1638400 1400
156112361 dayuanx C May 6, 2022, 4:01 p.m. OK GNU C++20 (64) TESTS 23 46 1638400 1400
156162508 Nakamiya C May 7, 2022, 5:56 a.m. OK GNU C++20 (64) TESTS 24 46 1638400 1400
156125063 ahmedr146 C May 6, 2022, 5:31 p.m. OK GNU C++20 (64) TESTS 23 46 1638400 1400
156119537 johnLate C May 6, 2022, 4:27 p.m. OK GNU C++20 (64) TESTS 23 46 1638400 1400
156118727 dedsec_29 C May 6, 2022, 4:24 p.m. OK GNU C++20 (64) TESTS 23 46 1638400 1400
156159112 _su1sen C May 7, 2022, 5:02 a.m. OK GNU C++20 (64) TESTS 24 46 1740800 1400
156133317 LXL C May 6, 2022, 6:58 p.m. OK Go TESTS 23 156 3276800 1400
156109663 LXL C May 6, 2022, 3:52 p.m. OK Go TESTS 23 170 3481600 1400
156151181 zelknow26 C May 7, 2022, 2:22 a.m. OK Go TESTS 24 187 4710400 1400
156114532 Sashe4ka2002 C May 6, 2022, 4:08 p.m. OK Haskell TESTS 23 811 69324800 1400
156150579 humwawe C May 7, 2022, 2:08 a.m. OK Java 11 TESTS 24 186 3276800 1400
156126109 henrychenOutlook C May 6, 2022, 5:39 p.m. OK Java 11 TESTS 23 218 0 1400
156162110 dandelight C May 7, 2022, 5:50 a.m. OK Java 11 TESTS 24 233 0 1400
156111553 MrOtter C May 6, 2022, 3:58 p.m. OK Java 11 TESTS 23 233 0 1400
156159368 sf14t C May 7, 2022, 5:06 a.m. OK Java 11 TESTS 24 233 12083200 1400
156123906 Wuya C May 6, 2022, 5:24 p.m. OK Java 11 TESTS 23 327 5529600 1400
156109137 sh_myname C May 6, 2022, 3:50 p.m. OK Java 11 TESTS 23 327 30105600 1400
156138595 yash13203 C May 6, 2022, 8:18 p.m. OK Java 11 TESTS 23 358 0 1400
156127283 ae167671 C May 6, 2022, 5:50 p.m. OK Java 11 TESTS 23 358 16998400 1400
156111214 thesupremeone C May 6, 2022, 3:57 p.m. OK Java 11 TESTS 23 358 30310400 1400
156138959 ccj123 C May 6, 2022, 8:25 p.m. OK Java 8 TESTS 23 124 0 1400
156121745 ibrahim.soltan918 C May 6, 2022, 4:34 p.m. OK Java 8 TESTS 23 140 0 1400
156135375 ibrahim.soltan918 C May 6, 2022, 7:26 p.m. OK Java 8 TESTS 23 155 0 1400
156127463 DoPractice C May 6, 2022, 5:52 p.m. OK Java 8 TESTS 23 155 0 1400
156125673 Abdallah_Ragab00 C May 6, 2022, 5:36 p.m. OK Java 8 TESTS 23 155 0 1400
156134565 arutsudar C May 6, 2022, 7:14 p.m. OK Java 8 TESTS 23 155 9420800 1400
156135914 ShivamMehta C May 6, 2022, 7:34 p.m. OK Java 8 TESTS 23 155 14950400 1400
156119186 arutsudar C May 6, 2022, 4:26 p.m. OK Java 8 TESTS 23 171 9420800 1400
156116256 cc4414 C May 6, 2022, 4:15 p.m. OK Java 8 TESTS 23 202 6041600 1400
156137045 NzsAq C May 6, 2022, 7:51 p.m. OK Java 8 TESTS 23 218 614400 1400
156114152 BruteForcee C May 6, 2022, 4:07 p.m. OK Kotlin 1.4 TESTS 23 264 16691200 1400
156118508 PeredurOmega C May 6, 2022, 4:23 p.m. OK Kotlin 1.4 TESTS 23 420 13516800 1400
156157500 ripity C May 7, 2022, 4:31 a.m. OK Kotlin 1.6 TESTS 24 374 14540800 1400
156145678 thegeman C May 6, 2022, 11:32 p.m. OK Kotlin 1.6 TESTS 24 966 11366400 1400
156118575 ktropin C May 6, 2022, 4:23 p.m. OK Mono C# TESTS 23 280 29491200 1400
156117684 xuancx C May 6, 2022, 4:20 p.m. OK MS C++ 2017 TESTS 23 93 1331200 1400
156115641 kibastian C May 6, 2022, 4:12 p.m. OK MS C++ 2017 TESTS 23 312 18329600 1400
156110576 danielson13579 C May 6, 2022, 3:55 p.m. OK MS C++ 2017 TESTS 23 327 2048000 1400
156130065 mishra-aayush C May 6, 2022, 6:18 p.m. OK MS C++ 2017 TESTS 23 358 8601600 1400
156120423 A_Pier C May 6, 2022, 4:31 p.m. OK MS C++ 2017 TESTS 23 436 7782400 1400
156147326 bhdtr C May 7, 2022, 12:36 a.m. OK MS C++ 2017 TESTS 24 623 7168000 1400
156119647 toxahak C May 6, 2022, 4:28 p.m. OK Node.js TESTS 23 265 20582400 1400
156124670 1_2_3_4_5_9 C May 6, 2022, 5:28 p.m. OK PyPy 2 TESTS 23 327 20992000 1400
156135550 xyxoro C May 6, 2022, 7:28 p.m. OK PyPy 3 TESTS 23 187 20787200 1400
156144119 KanishkGoel C May 6, 2022, 10:28 p.m. OK PyPy 3 TESTS 24 264 17100800 1400
156126243 pedrosorio C May 6, 2022, 5:40 p.m. OK PyPy 3 TESTS 23 280 13721600 1400
156111203 jano31415 C May 6, 2022, 3:57 p.m. OK PyPy 3 TESTS 23 342 16793600 1400
156116191 sunny_kr C May 6, 2022, 4:14 p.m. OK PyPy 3 TESTS 23 358 13516800 1400
156114423 arpan.parikh C May 6, 2022, 4:08 p.m. OK PyPy 3 TESTS 23 405 82534400 1400
156113591 zouyu9631 C May 6, 2022, 4:05 p.m. OK PyPy 3 TESTS 23 655 20787200 1400
156146730 jerwu C May 7, 2022, 12:14 a.m. OK PyPy 3-64 TESTS 24 187 25702400 1400
156157700 rivnam C May 7, 2022, 4:35 a.m. OK PyPy 3-64 TESTS 24 187 25907200 1400
156117436 Wendy0317 C May 6, 2022, 4:19 p.m. OK PyPy 3-64 TESTS 23 248 29900800 1400
156111661 petamingks C May 6, 2022, 3:58 p.m. OK PyPy 3-64 TESTS 23 265 22937600 1400
156126475 pedrosorio C May 6, 2022, 5:42 p.m. OK PyPy 3-64 TESTS 23 295 22937600 1400
156118619 SalatL C May 6, 2022, 4:24 p.m. OK PyPy 3-64 TESTS 23 295 22937600 1400
156147404 katonyonko C May 7, 2022, 12:38 a.m. OK PyPy 3-64 TESTS 24 295 23756800 1400
156110332 unknownSolver C May 6, 2022, 3:54 p.m. OK PyPy 3-64 TESTS 23 295 24268800 1400
156124456 Viper35 C May 6, 2022, 5:27 p.m. OK PyPy 3-64 TESTS 23 295 34099200 1400
156109391 aberent C May 6, 2022, 3:51 p.m. OK PyPy 3-64 TESTS 23 296 20992000 1400
156127106 NS3081992 C May 6, 2022, 5:48 p.m. OK Python 3 TESTS 23 264 8704000 1400
156126696 NS3081992 C May 6, 2022, 5:44 p.m. OK Python 3 TESTS 23 264 8704000 1400
156125258 NS3081992 C May 6, 2022, 5:32 p.m. OK Python 3 TESTS 23 265 12390400 1400
156126264 NS3081992 C May 6, 2022, 5:40 p.m. OK Python 3 TESTS 23 296 12390400 1400
156112256 Istarchick C May 6, 2022, 4 p.m. OK Python 3 TESTS 23 327 10854400 1400
156114263 aayush_chhabra C May 6, 2022, 4:07 p.m. OK Python 3 TESTS 23 342 154316800 1400
156116305 jinhwanlazy C May 6, 2022, 4:15 p.m. OK Python 3 TESTS 23 358 14131200 1400
156115958 sam1064max C May 6, 2022, 4:14 p.m. OK Python 3 TESTS 23 358 14131200 1400
156125651 shehebe C May 6, 2022, 5:35 p.m. OK Python 3 TESTS 23 390 9830400 1400
156124661 FrozenKandy C May 6, 2022, 5:28 p.m. OK Python 3 TESTS 23 530 148377600 1400

remove filters

Back to search problems