Codeforces Round 797 (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
1690 Codeforces Round 797 (Div. 3) FINISHED False 8100 82653863 June 7, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7338 ) F Shifting String PROGRAMMING graphs math number theory strings 1700

B"Polycarp found the string s and the permutation p . Their lengths turned out to be the same and equal to n . A permutation of n elements -- is an array of length n , in which every integer from 1 to n occurs exactly once. For example, [1, 2, 3] and [4, 3, 5, 1, 2] are permutations, but [1, 2, 4] , [4, 3, 2, 1, 2] and [0, 1, 2] are not. In one operation he can multiply s by p , so he replaces s with string new , in which for any i from 1 to n it is true that new_i = s_{p_i} . For example, with s=wmbe and p = [3, 1, 4, 2] , after operation the string will turn to s=s_3 s_1 s_4 s_2=bwem . Polycarp wondered after how many operations the string would become equal to its initial value for the first time. Since it may take too long, he asks for your help in this matter. It can be proved that the required number of operations always exists. It can be very large, so use a 64-bit integer type. The first line of input contains one integer t ( 1 <= t <= 5000 ) -- the number of test cases in input. The first line of each case contains single integer n ( 1 <= n <= 200 ) -- the length of string and permutation. The second line of each case contains a string s of length n , containing lowercase Latin letters. The third line of each case contains n integers -- permutation p ( 1 <= p_i <= n ), all p_i are different. Output t lines, each of which contains the answer to the corresponding test case of input. As an answer output single integer -- the minimum number of operations, after which the string s will become the same as it was before operations. In the first sample operation doesn't change the string, so it will become the same as it was after 1 operations. In the second sample the string will change as follows: "...

Tutorials

Codeforces Round #797 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
159952195 ruban F June 8, 2022, 3:37 p.m. OK Delphi TESTS 33 248 24576000 1700
159973659 Tahsin13 F June 8, 2022, 9:26 p.m. OK GNU C++14 TESTS 33 170 307200 1700
159915281 deepakyadav18 F June 8, 2022, 8:31 a.m. OK GNU C++14 TESTS 33 171 204800 1700
159931154 Kira_0999 F June 8, 2022, 11:29 a.m. OK GNU C++14 TESTS 33 171 307200 1700
159905930 demadog F June 8, 2022, 6:30 a.m. OK GNU C++14 TESTS 33 186 204800 1700
159984972 masud458 F June 9, 2022, 4:22 a.m. OK GNU C++14 TESTS 33 187 204800 1700
159984898 masud458 F June 9, 2022, 4:20 a.m. OK GNU C++14 TESTS 33 187 204800 1700
159967548 Omik_07 F June 8, 2022, 7:04 p.m. OK GNU C++14 TESTS 33 187 307200 1700
159916387 _ajthreac_ F June 8, 2022, 8:43 a.m. OK GNU C++14 TESTS 33 202 0 1700
159906747 ctldragon F June 8, 2022, 6:39 a.m. OK GNU C++14 TESTS 33 202 0 1700
159956328 obaydullahmhs F June 8, 2022, 4:32 p.m. OK GNU C++14 TESTS 33 202 307200 1700
159989177 Sameer_Raj F June 9, 2022, 5:48 a.m. OK GNU C++17 TESTS 33 156 204800 1700
159938272 captainlevi02 F June 8, 2022, 12:48 p.m. OK GNU C++17 TESTS 33 171 204800 1700
159941417 sugmedic F June 8, 2022, 1:24 p.m. OK GNU C++17 TESTS 33 171 307200 1700
159920676 shivangtiwari F June 8, 2022, 9:28 a.m. OK GNU C++17 TESTS 33 171 307200 1700
159909775 wifiiii F June 8, 2022, 7:13 a.m. OK GNU C++17 TESTS 33 171 409600 1700
159957045 Abdel-AzizMostafa F June 8, 2022, 4:41 p.m. OK GNU C++17 TESTS 33 171 3379200 1700
159961173 Jayce_Tang F June 8, 2022, 5:34 p.m. OK GNU C++17 TESTS 33 186 307200 1700
159956870 b4nd1t F June 8, 2022, 4:39 p.m. OK GNU C++17 TESTS 33 186 307200 1700
159939040 shreya_2121 F June 8, 2022, 12:57 p.m. OK GNU C++17 TESTS 33 186 409600 1700
159930792 abhi.ch891 F June 8, 2022, 11:25 a.m. OK GNU C++17 TESTS 33 186 3584000 1700
159904614 Freedom__King F June 8, 2022, 6:14 a.m. OK GNU C++17 (64) TESTS 33 62 7270400 1700
159987952 IkshitG F June 9, 2022, 5:25 a.m. OK GNU C++17 (64) TESTS 33 139 204800 1700
159984155 Kenshin2438 F June 9, 2022, 3:59 a.m. OK GNU C++17 (64) TESTS 33 139 204800 1700
159930882 GreyRaven F June 8, 2022, 11:26 a.m. OK GNU C++17 (64) TESTS 33 139 204800 1700
159942075 Rinors F June 8, 2022, 1:31 p.m. OK GNU C++17 (64) TESTS 33 140 102400 1700
159911208 prashar32 F June 8, 2022, 7:29 a.m. OK GNU C++17 (64) TESTS 33 140 102400 1700
159984415 sugmedic F June 9, 2022, 4:07 a.m. OK GNU C++17 (64) TESTS 33 140 204800 1700
159930467 MoNir_ F June 8, 2022, 11:22 a.m. OK GNU C++17 (64) TESTS 33 140 204800 1700
159917664 joker_pisces F June 8, 2022, 8:56 a.m. OK GNU C++17 (64) TESTS 33 140 512000 1700
159922702 sgly33 F June 8, 2022, 9:51 a.m. OK GNU C++17 (64) TESTS 33 155 0 1700
159977643 jigyansu_nanda F June 9, 2022, 12:23 a.m. OK GNU C++20 (64) TESTS 33 109 102400 1700
159958904 Leokkk17 F June 8, 2022, 5:06 p.m. OK GNU C++20 (64) TESTS 33 109 102400 1700
159937390 MiaomiaoZi F June 8, 2022, 12:39 p.m. OK GNU C++20 (64) TESTS 33 109 102400 1700
159917087 yiyyii F June 8, 2022, 8:51 a.m. OK GNU C++20 (64) TESTS 33 109 1638400 1700
159981104 chen-liang F June 9, 2022, 2:35 a.m. OK GNU C++20 (64) TESTS 33 109 3481600 1700
159979659 Swirl F June 9, 2022, 1:43 a.m. OK GNU C++20 (64) TESTS 33 124 0 1700
159950504 Elmahdy F June 8, 2022, 3:15 p.m. OK GNU C++20 (64) TESTS 33 124 0 1700
159949725 kumar_suraj_4 F June 8, 2022, 3:05 p.m. OK GNU C++20 (64) TESTS 33 124 0 1700
159985619 lucas.joel.han F June 9, 2022, 4:38 a.m. OK GNU C++20 (64) TESTS 33 124 102400 1700
159940237 starchaser F June 8, 2022, 1:11 p.m. OK GNU C++20 (64) TESTS 33 124 102400 1700
159954746 jiomart F June 8, 2022, 4:10 p.m. OK Java 11 TESTS 33 233 0 1700
159909976 kamannb F June 8, 2022, 7:15 a.m. OK Java 11 TESTS 33 343 0 1700
159941809 ArchitSharma F June 8, 2022, 1:28 p.m. OK Java 11 TESTS 33 389 0 1700
159974346 dzhi F June 8, 2022, 9:50 p.m. OK Java 11 TESTS 33 405 0 1700
159974383 dzhi F June 8, 2022, 9:51 p.m. OK Java 11 TESTS 33 436 0 1700
159921592 wat2 F June 8, 2022, 9:39 a.m. OK Java 11 TESTS 33 514 0 1700
159924099 goyalronak3 F June 8, 2022, 10:06 a.m. OK Java 11 TESTS 33 655 0 1700
159956680 aryaman_571 F June 8, 2022, 4:36 p.m. OK Java 11 TESTS 33 795 0 1700
159986342 JigarNainuji F June 9, 2022, 4:54 a.m. OK Java 11 TESTS 33 935 0 1700
159928218 saksham19270 F June 8, 2022, 10:56 a.m. OK Java 11 TESTS 33 1263 204800 1700
159934196 dheerajchhatanidc F June 8, 2022, 12:02 p.m. OK Java 8 TESTS 33 763 0 1700
159981204 shorya_goyal F June 9, 2022, 2:38 a.m. OK Java 8 TESTS 33 1232 0 1700
159930423 naveenkant227 F June 8, 2022, 11:21 a.m. OK Java 8 TESTS 33 1388 0 1700
159906120 swaggy_baba F June 8, 2022, 6:32 a.m. OK Java 8 TESTS 33 1668 0 1700
159948143 _Eyepatch F June 8, 2022, 2:43 p.m. OK Java 8 TESTS 33 1777 0 1700
159953089 linxiaotian F June 8, 2022, 3:49 p.m. OK Kotlin 1.4 TESTS 33 358 1536000 1700
159962446 LeoPro F June 8, 2022, 5:50 p.m. OK Kotlin 1.5 TESTS 33 623 0 1700
159936666 AlexeyT F June 8, 2022, 12:30 p.m. OK MS C++ 2017 TESTS 33 748 307200 1700
159977926 BigNerd24 F June 9, 2022, 12:35 a.m. OK PyPy 3 TESTS 33 312 20172800 1700
159906557 xuhao95 F June 8, 2022, 6:36 a.m. OK PyPy 3 TESTS 33 421 18636800 1700
159925776 xyxoro F June 8, 2022, 10:27 a.m. OK PyPy 3 TESTS 33 514 15974400 1700
159921676 wyxfwxh250821 F June 8, 2022, 9:40 a.m. OK PyPy 3 TESTS 33 639 18432000 1700
159919985 wyxfwxh250821 F June 8, 2022, 9:21 a.m. OK PyPy 3 TESTS 33 639 18534400 1700
159942232 YMSeah F June 8, 2022, 1:33 p.m. OK PyPy 3 TESTS 33 670 13312000 1700
159928139 ambs_ F June 8, 2022, 10:55 a.m. OK PyPy 3 TESTS 33 685 11059200 1700
159928220 ambs_ F June 8, 2022, 10:56 a.m. OK PyPy 3 TESTS 33 701 10956800 1700
159969111 tcltk F June 8, 2022, 7:32 p.m. OK PyPy 3 TESTS 33 701 11673600 1700
159965732 kwin F June 8, 2022, 6:35 p.m. OK PyPy 3 TESTS 33 794 11059200 1700
159945447 pxhdg F June 8, 2022, 2:09 p.m. OK PyPy 3-64 TESTS 33 186 16793600 1700
159920250 siganai F June 8, 2022, 9:24 a.m. OK PyPy 3-64 TESTS 33 264 18432000 1700
159923055 abhijeet.panihar.cse20 F June 8, 2022, 9:55 a.m. OK PyPy 3-64 TESTS 33 295 19456000 1700
159932718 coder_sounak F June 8, 2022, 11:46 a.m. OK PyPy 3-64 TESTS 33 420 25190400 1700
159942061 Anti-Neutrino F June 8, 2022, 1:31 p.m. OK PyPy 3-64 TESTS 33 530 11571200 1700
159982777 MistaAsh F June 9, 2022, 3:23 a.m. OK PyPy 3-64 TESTS 33 545 11468800 1700
159920810 Issin F June 8, 2022, 9:30 a.m. OK PyPy 3-64 TESTS 33 608 15667200 1700
159922344 abhaumik24 F June 8, 2022, 9:47 a.m. OK PyPy 3-64 TESTS 33 670 11776000 1700
159985400 Dependable19 F June 9, 2022, 4:32 a.m. OK PyPy 3-64 TESTS 33 717 12390400 1700
159947439 ikoma F June 8, 2022, 2:33 p.m. OK PyPy 3-64 TESTS 33 748 11366400 1700
159939210 H_Raja F June 8, 2022, 12:59 p.m. OK Python 3 TESTS 33 1216 6041600 1700
159960790 saini.laxman2002 F June 8, 2022, 5:29 p.m. OK Python 3 TESTS 33 1278 307200 1700
159967386 Ayush_ag F June 8, 2022, 7:01 p.m. OK Python 3 TESTS 33 1325 204800 1700
159946733 CodeLord1104 F June 8, 2022, 2:24 p.m. OK Python 3 TESTS 33 1559 307200 1700
159923457 kraanzu F June 8, 2022, 9:59 a.m. OK Python 3 TESTS 33 2401 9420800 1700
159925808 xyxoro F June 8, 2022, 10:27 a.m. OK Python 3 TESTS 33 2526 4710400 1700
159943397 recuraki F June 8, 2022, 1:46 p.m. OK Python 3 TESTS 33 2635 512000 1700
159943440 kuzinow F June 8, 2022, 1:47 p.m. OK Python 3 TESTS 33 2635 716800 1700

remove filters

Back to search problems