Codeforces Round 947 (Div. 1 + 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
1975 Codeforces Round 947 (Div. 1 + Div. 2) FINISHED False 10800 20532263 May 25, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 110 ) I Mind Bloom PROGRAMMING dp 3500

B'Jellyfish is playing a one-player card game called "Slay the Spire". There are n cards in total numbered from 1 to n . The i -th card has power c_i . There is a binary string s of length n . If s_i = texttt{0} , the i -th card is initially in the draw pile. If s_i = texttt{1} , the i -th card is initially in Jellyfish 's hand. Jellyfish will repeat the following process until either her hand or the draw pile is empty. At the end of this process, find the probability that Jellyfish can empty the draw pile, modulo 1 ,000 ,000 ,007 . Formally, let M=1 ,000 ,000 ,007 . It can be shown that the answer can be expressed as an irreducible fraction frac{p}{q} , where p and q are integers and q not equiv 0 pmod{M} . Output the integer equal to p cdot q^{-1} bmod M . In other words, output such an integer x that 0 <= x < M and x cdot q equiv p pmod{M} . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 100 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= q n <= q 120 ) -- the number of cards. The second line of each test case contains n integers c_1,c_2, ldots,c_n ( 0 <= q c_i <= q n ) -- the powers of the cards. It is guaranteed that c_1 <= q c_2 <= q ldots <= q c_n . The third line of each test case contains a binary string s of length n . If s_i = texttt{0} , the i -th card is initially in the draw pile. If s_i = texttt{1} , the i -th card is initially in Jellyfish 's hand. It is guaranteed that the sum of n^2 over all test cases does not exceed 120^2 . For each test case, output the probability that Jellyfish can empty the draw pile modulo 1 ,000 ,000 ,007 . In the first test case, Jellyfish will keep playing cards with power 1$'...

Tutorials

editorial_zh.pdf

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
262929283 princedyrus I May 27, 2024, 7:50 p.m. OK C++14 (GCC 6-32) TESTS 80 1483 8089600 3500
262849680 schrodingerstom I May 27, 2024, 8:21 a.m. OK C++14 (GCC 6-32) TESTS 80 1500 8089600 3500
262814348 luogu_bot1 I May 27, 2024, 2:17 a.m. OK C++17 (GCC 7-32) TESTS 80 390 13516800 3500
262838878 Ramo7fsw I May 27, 2024, 6:57 a.m. OK C++17 (GCC 7-32) TESTS 80 421 13516800 3500
262831074 Sparkle_Twilight I May 27, 2024, 5:41 a.m. OK C++17 (GCC 7-32) TESTS 80 421 14745600 3500
263565169 hunagjong_02 I June 1, 2024, 2:41 a.m. OK C++17 (GCC 7-32) TESTS 80 687 123392000 3500
263057214 Mohamedtarekfayez I May 28, 2024, 7:12 p.m. OK C++17 (GCC 7-32) TESTS 80 687 123392000 3500
263656954 subham082 I June 1, 2024, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 80 780 123392000 3500
263606452 naresh45 I June 1, 2024, 9:30 a.m. OK C++17 (GCC 7-32) TESTS 80 4202 116428800 3500
263232801 xiao_lang I May 30, 2024, 11:48 a.m. OK C++17 (GCC 7-32) TESTS 80 4359 116428800 3500
263232286 xiao_lang I May 30, 2024, 11:44 a.m. OK C++17 (GCC 7-32) TESTS 80 4452 116428800 3500
262834023 orzdevinwang I May 27, 2024, 6:14 a.m. OK C++20 (GCC 13-64) TESTS 80 327 123392000 3500
263525717 yasseinhamdy15 I May 31, 2024, 4:24 p.m. OK C++20 (GCC 13-64) TESTS 80 1155 125849600 3500
262840006 Engineer I May 27, 2024, 7:06 a.m. OK C++20 (GCC 13-64) TESTS 80 1156 125747200 3500
262892252 NikhilKumar_11 I May 27, 2024, 2:07 p.m. OK C++20 (GCC 13-64) TESTS 80 1171 125747200 3500
263528953 Atikur_Rahaman I May 31, 2024, 4:52 p.m. OK C++20 (GCC 13-64) TESTS 80 1203 125849600 3500
263068962 madurakavikovidh I May 28, 2024, 10:27 p.m. OK C++20 (GCC 13-64) TESTS 80 1234 125747200 3500
262975647 qyc333 I May 28, 2024, 7:40 a.m. OK C++20 (GCC 13-64) TESTS 80 1234 125747200 3500
262764371 Ormlis I May 26, 2024, 3:49 p.m. OK C++20 (GCC 13-64) TESTS 80 3905 4505600 3500

remove filters

Back to search problems