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 |
|---|---|---|---|---|---|---|
| 794 | Tinkoff Challenge - Final Round (Codeforces Round 414, rated, Div. 1 + Div. 2) | FINISHED | False | 7200 | 281737523 | May 13, 2017, 9:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 401 ) | G | Replace All | PROGRAMMING | combinatorics dp math | 3400 |
Igor the analyst is at work. He learned about a feature in his text editor called "Replace All". Igor is too bored at work and thus he came up with the following problem: Given two strings x and y which consist of the English letters ' A ' and ' B ' only, a pair of strings ( s , t ) is called good if: s and t consist of the characters ' 0 ' and ' 1 ' only. 1 ≤ | s |, | t | ≤ n , where | z | denotes the length of string z , and n is a fixed positive integer. If we replace all occurrences of ' A ' in x and y with the string s , and replace all occurrences of ' B ' in x and y with the string t , then the two obtained from x and y strings are equal. For example, if x = AAB , y = BB and n = 4 , then ( 01 , 0101 ) is one of good pairs of strings, because both obtained after replacing strings are " 01010101 ". The flexibility of a pair of strings x and y is the number of pairs of good strings ( s , t ) . The pairs are ordered, for example the pairs ( 0 , 1 ) and ( 1 , 0 ) are different. You're given two strings c and d . They consist of characters ' A ', ' B ' and ' ? ' only. Find the sum of flexibilities of all possible pairs of strings ( c ', d ') such that c ' and d ' can be obtained from c and d respectively by replacing the question marks with either ' A ' or ' B ', modulo 10 9 + 7 . The first line contains the string c ( 1 ≤ | c | ≤ 3·10 5 ). The second line contains the string d ( 1 ≤ | d | ≤ 3·10 5 ). The last line contains a single integer n ( 1 ≤ n ≤ 3·10 5 ). Output a single integer: the answer to the problem, modulo 10 9 + 7 . For the first sample, there are four possible pairs of ( c ', d ') . If ( c ', d ') = ( AA , A ) , then the flexibility is 0 . If ( c ', d ') = ( AB , A ) , then the flexibility is 0 . If ( c ', d ') = ( AA , B ) , then the flexibility is 2 , as the pairs of binary strings ( 1 , 11 ) , ( 0 , 00 ) are the only good pairs. If ( c ', d ') = ( AB , B ) , then the flexibility is 0 . Thus, the total flexibility is 2 . For the second s |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 27175536 | AkaneSasu | G | May 17, 2017, 8:49 a.m. | OK | GNU C++ | TESTS | 83 | 62 | 10240000 | 3400 | |
| 27703919 | diaosipan | G | June 10, 2017, 10:02 a.m. | OK | GNU C++ | TESTS | 83 | 62 | 31027200 | 3400 | |
| 28162617 | stony_oi | G | June 30, 2017, 3:15 a.m. | OK | GNU C++ | TESTS | 83 | 77 | 8704000 | 3400 | |
| 40828280 | vjudge3 | G | July 27, 2018, 4:22 a.m. | OK | GNU C++ | TESTS | 83 | 78 | 9011200 | 3400 | |
| 27703730 | diaosipan | G | June 10, 2017, 9:48 a.m. | OK | GNU C++ | TESTS | 83 | 78 | 10547200 | 3400 | |
| 42194673 | luogu_bot5 | G | Aug. 28, 2018, 5:41 a.m. | OK | GNU C++ | TESTS | 83 | 78 | 10854400 | 3400 | |
| 36432400 | vjudge1 | G | March 20, 2018, 12:28 p.m. | OK | GNU C++ | TESTS | 83 | 78 | 11366400 | 3400 | |
| 27201482 | krijgertje | G | May 18, 2017, 5:10 p.m. | OK | GNU C++ | TESTS | 83 | 93 | 12595200 | 3400 | |
| 27369259 | victbr | G | May 27, 2017, 7:47 a.m. | OK | GNU C++ | TESTS | 83 | 108 | 13209600 | 3400 | |
| 27996360 | King_of_Paladins | G | June 24, 2017, 3:33 a.m. | OK | GNU C++ | TESTS | 83 | 124 | 36147200 | 3400 | |
| 27301525 | rqgao2014 | G | May 23, 2017, 12:50 p.m. | OK | GNU C++11 | TESTS | 83 | 62 | 9318400 | 3400 | |
| 40981823 | ReaLNero1 | G | July 30, 2018, 6:09 p.m. | OK | GNU C++11 | TESTS | 83 | 77 | 9318400 | 3400 | |
| 52798401 | cly_none | G | April 15, 2019, 11:44 p.m. | OK | GNU C++11 | TESTS | 83 | 78 | 10240000 | 3400 | |
| 27542598 | Charming_Chen | G | June 3, 2017, 11:46 a.m. | OK | GNU C++11 | TESTS | 83 | 78 | 10547200 | 3400 | |
| 54050162 | KMAASZRAA | G | May 12, 2019, 7:40 p.m. | OK | GNU C++11 | TESTS | 83 | 78 | 10854400 | 3400 | |
| 47543529 | newbiegcz | G | Dec. 27, 2018, 8:37 a.m. | OK | GNU C++11 | TESTS | 83 | 78 | 10854400 | 3400 | |
| 34127265 | ChiliuDog | G | Jan. 13, 2018, 12:48 p.m. | OK | GNU C++11 | TESTS | 83 | 78 | 12902400 | 3400 | |
| 27212074 | Toxel | G | May 19, 2017, 10:14 a.m. | OK | GNU C++11 | TESTS | 83 | 78 | 16179200 | 3400 | |
| 27212049 | Toxel | G | May 19, 2017, 10:12 a.m. | OK | GNU C++11 | TESTS | 83 | 78 | 16179200 | 3400 | |
| 33098791 | FoolMike | G | Dec. 11, 2017, 10:05 a.m. | OK | GNU C++11 | TESTS | 83 | 78 | 25088000 | 3400 | |
| 27609528 | InvUsr | G | June 6, 2017, 9:20 a.m. | OK | GNU C++14 | TESTS | 83 | 62 | 6246400 | 3400 | |
| 27366282 | InvUsr | G | May 27, 2017, 2:57 a.m. | OK | GNU C++14 | TESTS | 83 | 62 | 8294400 | 3400 | |
| 27609716 | InvUsr | G | June 6, 2017, 9:31 a.m. | OK | GNU C++14 | TESTS | 83 | 62 | 9113600 | 3400 | |
| 27189348 | Los_Angelos_Laycurse | G | May 18, 2017, 3:01 a.m. | OK | GNU C++14 | TESTS | 83 | 78 | 9420800 | 3400 | |
| 27123219 | apiadu | G | May 15, 2017, 2:03 p.m. | OK | GNU C++14 | TESTS | 83 | 78 | 10854400 | 3400 | |
| 45391166 | aid | G | Nov. 6, 2018, 9:33 p.m. | OK | GNU C++14 | TESTS | 83 | 78 | 13209600 | 3400 | |
| 59424496 | Scut82 | G | Aug. 25, 2019, 12:55 a.m. | OK | GNU C++14 | TESTS | 83 | 78 | 13312000 | 3400 | |
| 59406123 | Scut82 | G | Aug. 24, 2019, 1:58 p.m. | OK | GNU C++14 | TESTS | 83 | 78 | 13312000 | 3400 | |
| 49041597 | black_horse2014 | G | Jan. 27, 2019, 6:42 a.m. | OK | GNU C++14 | TESTS | 83 | 78 | 14745600 | 3400 | |
| 27660737 | I_Love_Umirzhanova_Amina | G | June 8, 2017, 12:51 a.m. | OK | GNU C++14 | TESTS | 83 | 78 | 15052800 | 3400 | |
| 69611659 | gongsuidashen | G | Jan. 27, 2020, 11:43 a.m. | OK | GNU C++17 | TESTS | 83 | 77 | 9318400 | 3400 | |
| 52935205 | CMXRYNP | G | April 18, 2019, 5:57 a.m. | OK | GNU C++17 | TESTS | 83 | 78 | 10649600 | 3400 | |
| 40760806 | lllllllllllllllllllllll | G | July 26, 2018, 3:21 a.m. | OK | GNU C++17 | TESTS | 83 | 93 | 9011200 | 3400 | |
| 50410958 | vjudge5 | G | Feb. 24, 2019, 2:33 a.m. | OK | GNU C++17 | TESTS | 83 | 93 | 10854400 | 3400 | |
| 55977522 | Shayan.P | G | June 23, 2019, 6:28 p.m. | OK | GNU C++17 | TESTS | 83 | 187 | 13619200 | 3400 | |
| 52933860 | _Happy_New_Year_ | G | April 18, 2019, 4:59 a.m. | OK | GNU C++17 | TESTS | 83 | 187 | 70144000 | 3400 | |
| 57005628 | hjk1030 | G | July 14, 2019, 6:35 a.m. | OK | GNU C++17 | TESTS | 83 | 217 | 6656000 | 3400 | |
| 57165917 | Benq | G | July 16, 2019, 10:44 p.m. | OK | GNU C++17 | TESTS | 83 | 342 | 28569600 | 3400 | |
| 58481120 | Romeolong | G | Aug. 9, 2019, 5:36 a.m. | OK | GNU C++17 | TESTS | 83 | 343 | 20480000 | 3400 | |
| 55722829 | Smaug | G | June 18, 2019, 4:11 p.m. | OK | GNU C++17 | TESTS | 83 | 514 | 44748800 | 3400 | |
| 27551339 | I_love_Tvoya_Mamasha | G | June 3, 2017, 7:54 p.m. | OK | Java 8 | TESTS | 83 | 264 | 3276800 | 3400 | |
| 27088367 | Petr | G | May 13, 2017, 12:14 p.m. | OK | Java 8 | TESTS | 83 | 264 | 3276800 | 3400 | |
| 30895595 | JShinjuro | G | Oct. 1, 2017, 12:51 a.m. | OK | Java 8 | TESTS | 83 | 265 | 3276800 | 3400 | |
| 27189340 | Los_Angelos_Laycurse | G | May 18, 2017, 3:01 a.m. | OK | MS C++ | TESTS | 83 | 93 | 9523200 | 3400 |
Back to search problems