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 |
---|---|---|---|---|---|---|
1838 | Codeforces Round 877 (Div. 2) | FINISHED | False | 7200 | 51290063 | June 4, 2023, 2:45 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3362 ) | D | Bracket Walk | PROGRAMMING | constructive algorithms data structures implementation sortings strings |
B'There is a string s of length n consisting of the characters '( ' and ') '. You are walking on this string. You start by standing on top of the first character of s , and you want to make a sequence of moves such that you end on the n -th character. In one step, you can move one space to the left (if you are not standing on the first character), or one space to the right (if you are not standing on the last character). You may not stay in the same place, however you may visit any character, including the first and last character, any number of times. At each point in time, you write down the character you are currently standing on. We say the string is walkable if there exists some sequence of moves that take you from the first character to the last character, such that the string you write down is a regular bracket sequence. A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1 ' and '+ ' between the original characters of the sequence. For example, bracket sequences "()()", "(())" are regular (the resulting expressions are: "(1)+(1)", "((1+1)+1)"), and ")(" and "(" are not. You are given q queries. Each query flips the value of a character from '( ' to ') ' or vice versa. After each query, determine whether the string is walkable. Queries are cumulative, so the effects of each query carry on to future queries. The first line of the input contains two integers n and q ( 1 <= n, q <= 2 cdot 10^5 ) -- the size of the string and the number of queries, respectively. The second line of the input contains a string s of size n , consisting of the characters '( ' and ') ' -- the initial bracket string. Each of the next q lines contains a single integer i ( 1 <= i <= n ) -- the index of the character to flip for that query. For each query, print "YES" if the string is walkable after that query, and "NO" otherwis'... |
Codeforces Round #877 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
208545838 | Tdyx | D | June 5, 2023, 4:36 a.m. | OK | C# 10 | TESTS | 70 | 140 | 21606400 | ||
208521308 | defective | D | June 4, 2023, 7:10 p.m. | OK | GNU C++14 | TESTS | 70 | 139 | 3481600 | ||
208541677 | Adarshs_27 | D | June 5, 2023, 3:25 a.m. | OK | GNU C++14 | TESTS | 70 | 139 | 3584000 | ||
208530609 | gkggg_15 | D | June 4, 2023, 9:53 p.m. | OK | GNU C++14 | TESTS | 70 | 155 | 3584000 | ||
208530090 | haumaukhau | D | June 4, 2023, 9:38 p.m. | OK | GNU C++14 | TESTS | 70 | 156 | 3481600 | ||
208542906 | zhuoxingmu | D | June 5, 2023, 3:48 a.m. | OK | GNU C++14 | TESTS | 70 | 171 | 3276800 | ||
208537373 | lasventuras | D | June 5, 2023, 1:51 a.m. | OK | GNU C++14 | TESTS | 70 | 171 | 3584000 | ||
208530555 | gkggg_15 | D | June 4, 2023, 9:51 p.m. | OK | GNU C++14 | TESTS | 70 | 171 | 3584000 | ||
208506034 | tokitsukaze | D | June 4, 2023, 4:37 p.m. | OK | GNU C++14 | TESTS | 70 | 171 | 3584000 | ||
208502977 | 72txdy | D | June 4, 2023, 4:29 p.m. | OK | GNU C++14 | TESTS | 70 | 202 | 3481600 | ||
208503419 | ciuim | D | June 4, 2023, 4:31 p.m. | OK | GNU C++14 | TESTS | 70 | 202 | 10444800 |
Back to search problems