Codeforces Round 536 (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
1106 Codeforces Round 536 (Div. 2) FINISHED False 9600 182885099 Jan. 31, 2019, 12:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 988 ) F Lunar New Year and a Recursive Sequence PROGRAMMING math matrices number theory 2400

B"Lunar New Year is approaching, and Bob received a gift from his friend recently -- a recursive sequence! He loves this sequence very much and wants to play with it. Let f_1, f_2, ldots, f_i, ldots be an infinite sequence of positive integers. Bob knows that for i > k , f_i can be obtained by the following recursive equation: f_i = <= ft(f_{i - 1} ^ {b_1} cdot f_{i - 2} ^ {b_2} cdot cdots cdot f_{i - k} ^ {b_k} right) bmod p, which in short is f_i = <= ft( prod_{j = 1}^{k} f_{i - j}^{b_j} right) bmod p, where p = 998 ,244 ,353 (a widely-used prime), b_1, b_2, ldots, b_k are known integer constants, and x bmod y denotes the remainder of x divided by y . Bob lost the values of f_1, f_2, ldots, f_k , which is extremely troublesome xe2 x80 x93 these are the basis of the sequence! Luckily, Bob remembers the first k - 1 elements of the sequence: f_1 = f_2 = ldots = f_{k - 1} = 1 and the n -th element: f_n = m . Please find any possible value of f_k . If no solution exists, just tell Bob that it is impossible to recover his favorite sequence, regardless of Bob's sadness. The first line contains a positive integer k ( 1 <= q k <= q 100 ), denoting the length of the sequence b_1, b_2, ldots, b_k . The second line contains k positive integers b_1, b_2, ldots, b_k ( 1 <= q b_i < p ). The third line contains two positive integers n and m ( k < n <= q 10^9 , 1 <= q m < p ), which implies f_n = m . Output a possible value of f_k , where f_k is a positive integer satisfying 1 <= q f_k < p . If there are multiple answers, print any of them. If no such f_k makes f_n = m , output -1 instead. It is easy to show that if there are some possible values of f_k , there must be at least one satisfying 1 <= q f_k < p . In the first sample, we have f_4 = f_3^2 cdot f_2^3 cd"...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
49327969 rainboy F Feb. 1, 2019, 2:53 p.m. OK GNU C11 TESTS 50 327 614400 2400
49297762 rainboy F Feb. 1, 2019, 12:20 a.m. OK GNU C11 TESTS 50 342 1433600 2400
54388715 rainboy F May 19, 2019, 2:53 p.m. OK GNU C11 TESTS 50 343 614400 2400
49447838 Winniechen F Feb. 4, 2019, 4:51 a.m. OK GNU C++11 TESTS 50 46 102400 2400
49398765 luogu_bot4 F Feb. 3, 2019, 1:41 p.m. OK GNU C++11 TESTS 50 46 1228800 2400
49398734 zqy1018 F Feb. 3, 2019, 1:40 p.m. OK GNU C++11 TESTS 50 46 1228800 2400
49285222 Winniechen F Jan. 31, 2019, 5:34 p.m. OK GNU C++11 TESTS 50 46 3788800 2400
49285043 Winniechen F Jan. 31, 2019, 5:32 p.m. OK GNU C++11 TESTS 50 46 3891200 2400
49284858 Winniechen F Jan. 31, 2019, 5:29 p.m. OK GNU C++11 TESTS 50 46 4608000 2400
49298550 chenqiuyuan233 F Feb. 1, 2019, 1:03 a.m. OK GNU C++11 TESTS 50 62 1228800 2400
57711036 py_ultron F July 24, 2019, 11:48 p.m. OK GNU C++11 TESTS 50 171 1228800 2400
54239482 vjudge2 F May 16, 2019, 12:20 p.m. OK GNU C++11 TESTS 50 171 1228800 2400
54162415 Master_Yi F May 15, 2019, 7:11 a.m. OK GNU C++11 TESTS 50 171 1228800 2400
62425040 beet F Oct. 12, 2019, 2:02 p.m. OK GNU C++14 TESTS 50 31 1126400 2400
62087547 beet F Oct. 8, 2019, 3:24 a.m. OK GNU C++14 TESTS 50 46 1126400 2400
49602005 krijgertje F Feb. 7, 2019, 5:32 p.m. OK GNU C++14 TESTS 50 46 1228800 2400
49616618 Aswini.A F Feb. 8, 2019, 6:35 a.m. OK GNU C++14 TESTS 50 46 1228800 2400
54654170 beet F May 26, 2019, 7:19 a.m. OK GNU C++14 TESTS 50 46 1331200 2400
55493603 beet F June 12, 2019, 11:22 a.m. OK GNU C++14 TESTS 50 46 1331200 2400
57349455 hoke_t F July 20, 2019, 2:28 a.m. OK GNU C++14 TESTS 50 46 1638400 2400
63245542 beet F Oct. 23, 2019, 2:34 p.m. OK GNU C++14 TESTS 50 46 1638400 2400
63245276 beet F Oct. 23, 2019, 2:30 p.m. OK GNU C++14 TESTS 50 46 1638400 2400
63303972 beet F Oct. 24, 2019, 3:04 p.m. OK GNU C++14 TESTS 50 46 1638400 2400
49392363 imxian F Feb. 3, 2019, 10:40 a.m. OK GNU C++17 TESTS 50 46 1433600 2400
49678342 alaneos777 F Feb. 9, 2019, 9:38 p.m. OK GNU C++17 TESTS 50 46 1740800 2400
49323403 Akikaze F Feb. 1, 2019, 1:12 p.m. OK GNU C++17 TESTS 50 61 716800 2400
49282375 Akikaze F Jan. 31, 2019, 4:52 p.m. OK GNU C++17 TESTS 50 61 4096000 2400
49342639 Akikaze F Feb. 2, 2019, 1:48 a.m. OK GNU C++17 TESTS 50 62 614400 2400
49342662 Akikaze F Feb. 2, 2019, 1:51 a.m. OK GNU C++17 TESTS 50 62 614400 2400
50229018 Shayan.P F Feb. 20, 2019, 8:21 a.m. OK GNU C++17 TESTS 50 62 1433600 2400
49279500 thuytrang12a2 F Jan. 31, 2019, 3:07 p.m. OK GNU C++17 TESTS 50 62 4096000 2400
50809596 bert30702 F March 5, 2019, 7:52 a.m. OK GNU C++17 TESTS 50 62 84070400 2400
49401468 Masuk_Mia2018 F Feb. 3, 2019, 2:59 p.m. OK GNU C++17 TESTS 50 93 5632000 2400
49295506 savinov F Jan. 31, 2019, 10:12 p.m. OK Go TESTS 50 46 716800 2400
66614513 dalt F Dec. 11, 2019, 2:22 a.m. OK Java 8 TESTS 50 187 20377600 2400
49385020 ankurdua15 F Feb. 3, 2019, 6:09 a.m. OK Java 8 TESTS 50 482 0 2400
49297761 Dukkha F Feb. 1, 2019, 12:20 a.m. OK Java 8 TESTS 50 592 0 2400
52039269 zhishou F March 30, 2019, 5:43 p.m. OK Java 8 TESTS 50 624 0 2400
54388714 Dukkha F May 19, 2019, 2:53 p.m. OK Java 8 TESTS 50 639 0 2400
49327967 Dukkha F Feb. 1, 2019, 2:53 p.m. OK Java 8 TESTS 50 639 0 2400
49475483 xodiac F Feb. 4, 2019, 7:11 p.m. OK Java 8 TESTS 50 686 0 2400
49335963 Jeel_Vaishnav F Feb. 1, 2019, 6:29 p.m. OK Java 8 TESTS 50 717 0 2400
49398347 Ahmed_Diab F Feb. 3, 2019, 1:29 p.m. OK Java 8 TESTS 50 795 0 2400
66591029 dalt F Dec. 10, 2019, 1 p.m. OK Java 8 TESTS 50 873 19148800 2400
49859401 tangbinjie F Feb. 13, 2019, 8:47 a.m. OK MS C++ 2017 TESTS 50 733 1638400 2400
51123726 min05 F March 10, 2019, 10:36 a.m. OK MS C++ 2017 TESTS 50 904 1843200 2400
60643732 siwei F Sept. 15, 2019, 4:20 p.m. OK MS C++ 2017 TESTS 50 920 1331200 2400
49912818 frederika F Feb. 14, 2019, 3:02 p.m. OK PyPy 2 TESTS 50 2854 8192000 2400
49909139 frederika F Feb. 14, 2019, 1:22 p.m. OK PyPy 2 TESTS 50 2869 8396800 2400
49911433 frederika F Feb. 14, 2019, 2:22 p.m. OK PyPy 2 TESTS 50 2901 8601600 2400
49289140 pedrofreire F Jan. 31, 2019, 6:44 p.m. OK PyPy 3 TESTS 50 2948 32563200 2400
51451092 CountZero F March 18, 2019, 2:46 p.m. OK Rust TESTS 50 420 1024000 2400
51451406 CountZero F March 18, 2019, 2:53 p.m. OK Rust TESTS 50 436 1024000 2400
51450877 CountZero F March 18, 2019, 2:40 p.m. OK Rust TESTS 50 467 1024000 2400
51447866 CountZero F March 18, 2019, 1:21 p.m. OK Rust TESTS 50 499 1024000 2400
51450360 CountZero F March 18, 2019, 2:26 p.m. OK Rust TESTS 50 514 1024000 2400
49395983 CountZero F Feb. 3, 2019, 12:22 p.m. OK Rust TESTS 50 514 1024000 2400
49502575 kobae964 F Feb. 5, 2019, 3:56 p.m. OK Rust TESTS 50 592 3481600 2400
49276657 rustaurance F Jan. 31, 2019, 2:41 p.m. OK Rust TESTS 50 1092 4300800 2400

remove filters

Back to search problems