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 |
---|---|---|---|---|---|---|
1987 | EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 17421863 | June 30, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 176 ) | G2 | Spinning Round (Hard Version) | PROGRAMMING | dp |
B'This is the hard version of the problem. The only difference between the two versions are the allowed characters in s . You can make hacks only if both versions of the problem are solved. You are given a permutation p of length n . You are also given a string s of length n , where each character is either L, R, or ?. For each i from 1 to n : Initially, you have an undirected graph with n vertices (numbered from 1 to n ) and no edges. Then, for each i from 1 to n , add one edge to the graph: Find the maximum possible diameter over all connected ^{ text{ xe2 x88 x97}} graphs that you can form. Output -1 if it is not possible to form any connected graphs. ^{ text{ xe2 x88 x97}} Let d(s, t) denote the smallest number of edges on any path between s and t . The diameter of the graph is defined as the maximum value of d(s, t) over all pairs of vertices s and t . Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 4 cdot 10^5 ) -- the length of the permutation p . The second line of each test case contains n integers p_1,p_2, ldots, p_n ( 1 <= p_i <= n ) -- the elements of p , which are guaranteed to form a permutation. The third line of each test case contains a string s of length n . It is guaranteed that it consists only of the characters L, R, and ?. It is guaranteed that the sum of n over all test cases does not exceed 4 cdot 10^5 . For each test case, output the maximum possible diameter over all connected graphs that you form, or -1 if it is not possible to form any connected graphs. In the first test case, there are two connected graphs (the labels '... |
EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
268211532 | crazy_sea | G2 | June 30, 2024, 5:08 p.m. | OK | C++14 (GCC 6-32) | TESTS | 242 | 217 | 47923200 | ||
268267707 | Sparkle_Twilight | G2 | July 1, 2024, 5:41 a.m. | OK | C++17 (GCC 7-32) | TESTS | 242 | 202 | 48025600 | ||
268217291 | JoesSR_ | G2 | June 30, 2024, 5:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 242 | 233 | 48435200 | ||
268209119 | ksun48 | G2 | June 30, 2024, 5:01 p.m. | OK | C++17 (GCC 7-32) | TESTS | 242 | 312 | 62668800 | ||
268259358 | yangster67 | G2 | July 1, 2024, 4:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 187 | 16998400 | ||
268210865 | gamegame | G2 | June 30, 2024, 5:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 249 | 13926400 | ||
268256974 | Lynkcat | G2 | July 1, 2024, 3:32 a.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 281 | 136704000 | ||
268209905 | tourist | G2 | June 30, 2024, 5:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 327 | 91852800 | ||
268260065 | your_submissions_ | G2 | July 1, 2024, 4:11 a.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 390 | 73625600 | ||
268216966 | cat_of_Nesraychan | G2 | June 30, 2024, 5:25 p.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 640 | 143155200 | ||
268254428 | aklk1ng | G2 | July 1, 2024, 2:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 242 | 1890 | 104448000 |
Back to search problems