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.
Problems
B'You are given a string a , consisting of n characters, n is even. For each i from 1 to n a_i is one of 'A ', 'B ' or 'C '. A bracket sequence is a string containing only characters "(" and ")". 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 "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)"), and ")(", "(" and ")" are not. You want to find a string b that consists of n characters such that: In other words, you want to replace all occurrences of 'A ' with the same type of bracket, then all occurrences of 'B ' with the same type of bracket and all occurrences of 'C ' with the same type of bracket. Your task is to determine if such a string b exists. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. Then the descriptions of t testcases follow. The only line of each testcase contains a string a . a consists only of uppercase letters 'A ', 'B ' and 'C '. Let n be the length of a . It is guaranteed that n is even and 2 <= n <= 50 . For each testcase print "YES" if there exists such a string b that: Otherwise, print "NO". You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES are all recognized as positive answer). In the first testcase one of the possible strings b is "(())()". In the second testcase one of the possible strings b is "()()". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
108940766 |
math_id |
A |
March 2, 2021, 4:37 p.m. |
OK |
GNU C++11 |
TESTS |
3 |
0 |
0 |
|
|
108969096 |
liujia123456 |
A |
March 3, 2021, 2:49 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108968754 |
Masterpichicho |
A |
March 3, 2021, 2:38 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108976673 |
Mars_Coder |
A |
March 3, 2021, 5:44 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108975860 |
stronx |
A |
March 3, 2021, 5:31 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108973149 |
Hoshizora_Z |
A |
March 3, 2021, 4:39 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108971937 |
akashrocker |
A |
March 3, 2021, 4:11 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108970280 |
milinda02 |
A |
March 3, 2021, 3:25 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108969643 |
YareYare |
A |
March 3, 2021, 3:08 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108969105 |
z_thorn |
A |
March 3, 2021, 2:49 a.m. |
OK |
GNU C++11 |
TESTS |
18 |
15 |
0 |
|
|
108948418 |
tarush01 |
A |
March 2, 2021, 5:12 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
0 |
0 |
|
|
108957660 |
S_G_ |
A |
March 2, 2021, 7:22 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108960610 |
IngaleAnkur10 |
A |
March 2, 2021, 8:26 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108958715 |
varun0001 |
A |
March 2, 2021, 7:42 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108977206 |
Aaj_me_fodega |
A |
March 3, 2021, 5:53 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108973522 |
fractal |
A |
March 3, 2021, 4:46 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108972017 |
Bhavesh_Sharma |
A |
March 3, 2021, 4:13 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108971560 |
antriksh1685 |
A |
March 3, 2021, 4:02 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108971046 |
soulgugu |
A |
March 3, 2021, 3:47 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108967234 |
irreversible |
A |
March 3, 2021, 1:38 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
15 |
0 |
|
|
108940979 |
axoctavian |
A |
March 2, 2021, 4:38 p.m. |
OK |
.NET Core C# |
TESTS |
3 |
93 |
409600 |
|
|
108969662 |
NabilMashrief_ |
A |
March 3, 2021, 3:08 a.m. |
OK |
.NET Core C# |
TESTS |
18 |
93 |
2457600 |
|
|
remove filters
Back to search problems