Codeforces Round 794 (Div. 1)

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
1685 Codeforces Round 794 (Div. 1) FINISHED False 8100 78323099 May 25, 2022, 5:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3298 ) B Linguistics PROGRAMMING greedy implementation strings 2000

B"Alina has discovered a weird language, which contains only 4 words: texttt{A} , texttt{B} , texttt{AB} , texttt{BA} . It also turned out that there are no spaces in this language: a sentence is written by just concatenating its words into a single string. Alina has found one such sentence s and she is curious: is it possible that it consists of precisely a words texttt{A} , b words texttt{B} , c words texttt{AB} , and d words texttt{BA} ? In other words, determine, if it's possible to concatenate these a+b+c+d words in some order so that the resulting string is s . Each of the a+b+c+d words must be used exactly once in the concatenation, but you can choose the order in which they are concatenated. The first line of the input contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains four integers a , b , c , d ( 0 <= a,b,c,d <= 2 cdot 10^5 ) -- the number of times that words texttt{A} , texttt{B} , texttt{AB} , texttt{BA} respectively must be used in the sentence. The second line contains the string s ( s consists only of the characters texttt{A} and texttt{B} , 1 <= |s| <= 2 cdot 10^5 , |s|=a+b+2c+2d ) -- the sentence. Notice that the condition |s|=a+b+2c+2d (here |s| denotes the length of the string s ) is equivalent to the fact that s is as long as the concatenation of the a+b+c+d words. The sum of the lengths of s over all test cases doesn't exceed 2 cdot 10^5 . For each test case output texttt{YES} if it is possible that the sentence s consists of precisely a words texttt{A} , b words texttt{B} , c words texttt{AB} , and d words texttt{BA} , and tex"...

Tutorials

103198

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
158445980 mban259 B May 25, 2022, 6:29 p.m. OK C# 10 TESTS 94 140 3686400 2000
158430396 hos.lyric B May 25, 2022, 5:57 p.m. OK D TESTS 94 31 4198400 2000
158443871 Gassa B May 25, 2022, 6:24 p.m. OK D TESTS 94 202 6144000 2000
158456245 chro4896 B May 25, 2022, 7 p.m. OK GNU C11 TESTS 94 62 3379200 2000
158449185 antguz B May 25, 2022, 6:37 p.m. OK GNU C++14 TESTS 94 15 409600 2000
158553689 pazuzu B May 26, 2022, 5:28 p.m. OK GNU C++14 TESTS 94 15 716800 2000
158554230 spentplaying B May 26, 2022, 5:35 p.m. OK GNU C++14 TESTS 94 15 716800 2000
158443111 awoo B May 25, 2022, 6:22 p.m. OK GNU C++14 TESTS 94 15 921600 2000
158524931 Phantasy B May 26, 2022, 12:14 p.m. OK GNU C++14 TESTS 94 15 921600 2000
158449814 Max_Calincu B May 25, 2022, 6:39 p.m. OK GNU C++14 TESTS 94 15 1228800 2000
158459585 mat_v B May 25, 2022, 7:13 p.m. OK GNU C++14 TESTS 94 15 1638400 2000
158448292 LZDQ B May 25, 2022, 6:35 p.m. OK GNU C++14 TESTS 94 15 1740800 2000
158453024 CoachDanke B May 25, 2022, 6:49 p.m. OK GNU C++14 TESTS 94 15 1740800 2000
158439050 meteor_shower B May 25, 2022, 6:13 p.m. OK GNU C++14 TESTS 94 15 1945600 2000
158443894 vishnugupta123 B May 25, 2022, 6:24 p.m. OK GNU C++17 TESTS 94 15 512000 2000
158481319 Dd2dD2 B May 26, 2022, 1:44 a.m. OK GNU C++17 TESTS 94 15 614400 2000
158471038 sHaHriAr_17s B May 25, 2022, 8:34 p.m. OK GNU C++17 TESTS 94 15 614400 2000
158444005 NullXD B May 25, 2022, 6:24 p.m. OK GNU C++17 TESTS 94 15 614400 2000
158574338 qianyue B May 27, 2022, 2:11 a.m. OK GNU C++17 TESTS 94 15 614400 2000
158445739 Alon-Tanay B May 25, 2022, 6:28 p.m. OK GNU C++17 TESTS 94 15 716800 2000
158446072 lxhgww B May 25, 2022, 6:29 p.m. OK GNU C++17 TESTS 94 15 716800 2000
158472103 aryan12 B May 25, 2022, 8:50 p.m. OK GNU C++17 TESTS 94 15 1228800 2000
158446265 KDVinit B May 25, 2022, 6:29 p.m. OK GNU C++17 TESTS 94 15 1228800 2000
158542850 stubborn_1 B May 26, 2022, 3:15 p.m. OK GNU C++17 TESTS 94 15 1228800 2000
158452340 propane B May 25, 2022, 6:46 p.m. OK GNU C++17 (64) TESTS 94 15 614400 2000
158433489 Hyperbolic B May 25, 2022, 6:02 p.m. OK GNU C++17 (64) TESTS 94 15 614400 2000
158468925 propane B May 25, 2022, 8:14 p.m. OK GNU C++17 (64) TESTS 94 15 614400 2000
158537259 Renaxis B May 26, 2022, 2:26 p.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158512048 anonymous_777 B May 26, 2022, 9:44 a.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158483498 yzc2005 B May 26, 2022, 2:38 a.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158453778 eriksuenderhauf B May 25, 2022, 6:51 p.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158442567 natofp B May 25, 2022, 6:21 p.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158442259 Sana B May 25, 2022, 6:20 p.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158561104 Makcum888 B May 26, 2022, 7:12 p.m. OK GNU C++17 (64) TESTS 94 15 819200 2000
158451900 2262014932 B May 25, 2022, 6:45 p.m. OK GNU C++20 (64) TESTS 94 15 512000 2000
158454355 Uanogcdp B May 25, 2022, 6:53 p.m. OK GNU C++20 (64) TESTS 94 15 512000 2000
158450699 Grigori B May 25, 2022, 6:41 p.m. OK GNU C++20 (64) TESTS 94 15 512000 2000
158433419 soltanbh B May 25, 2022, 6:02 p.m. OK GNU C++20 (64) TESTS 94 15 512000 2000
158517380 silxi B May 26, 2022, 10:50 a.m. OK GNU C++20 (64) TESTS 94 15 614400 2000
158510822 Nero B May 26, 2022, 9:28 a.m. OK GNU C++20 (64) TESTS 94 15 614400 2000
158484915 tarjen B May 26, 2022, 3:11 a.m. OK GNU C++20 (64) TESTS 94 15 614400 2000
158476305 tloinuy B May 25, 2022, 10:35 p.m. OK GNU C++20 (64) TESTS 94 15 614400 2000
158476173 tloinuy B May 25, 2022, 10:30 p.m. OK GNU C++20 (64) TESTS 94 15 614400 2000
158574980 don2001 B May 27, 2022, 2:32 a.m. OK GNU C++20 (64) TESTS 94 15 614400 2000
158572958 PikaChu999 B May 27, 2022, 1:27 a.m. OK Java 11 TESTS 94 186 0 2000
158462853 insert_cool_handle B May 25, 2022, 7:27 p.m. OK Java 11 TESTS 94 218 0 2000
158470584 jxin31415 B May 25, 2022, 8:28 p.m. OK Java 8 TESTS 94 139 0 2000
158439871 SecondThread B May 25, 2022, 6:15 p.m. OK Java 8 TESTS 94 186 38809600 2000
158437923 Hakiobo B May 25, 2022, 6:10 p.m. OK Kotlin 1.4 TESTS 94 140 0 2000
158459844 baep_j B May 25, 2022, 7:14 p.m. OK MS C++ 2017 TESTS 94 31 614400 2000
158449734 machine_solution B May 25, 2022, 6:39 p.m. OK MS C++ 2017 TESTS 94 31 921600 2000
158494955 DavitMarg B May 26, 2022, 6:03 a.m. OK MS C++ 2017 TESTS 94 46 3788800 2000
158450271 misorin B May 25, 2022, 6:40 p.m. OK PyPy 3 TESTS 94 186 6246400 2000
158464465 hxu10 B May 25, 2022, 7:35 p.m. OK PyPy 3 TESTS 94 217 8601600 2000
158460860 tcltk B May 25, 2022, 7:19 p.m. OK PyPy 3 TESTS 94 296 9830400 2000
158464981 titia B May 25, 2022, 7:37 p.m. OK PyPy 3 TESTS 94 327 9625600 2000
158517233 ruimina B May 26, 2022, 10:48 a.m. OK PyPy 3 TESTS 94 482 9932800 2000
158501651 Sufiyan18 B May 26, 2022, 7:29 a.m. OK PyPy 3 TESTS 94 483 12185600 2000
158439727 whatshisbucket B May 25, 2022, 6:14 p.m. OK PyPy 3 TESTS 94 576 10444800 2000
158428535 conqueror_of_tourist B May 25, 2022, 5:54 p.m. OK PyPy 3-64 TESTS 94 233 10035200 2000
158523143 asdsasd B May 26, 2022, 11:53 a.m. OK PyPy 3-64 TESTS 94 233 11468800 2000
158460765 shobonvip B May 25, 2022, 7:18 p.m. OK PyPy 3-64 TESTS 94 295 10547200 2000
158526961 2020TAndr B May 26, 2022, 12:35 p.m. OK PyPy 3-64 TESTS 94 296 11366400 2000
158544524 ssb1920 B May 26, 2022, 3:34 p.m. OK PyPy 3-64 TESTS 94 467 20582400 2000
158543342 denny_sem B May 26, 2022, 3:21 p.m. OK PyPy 3-64 TESTS 94 530 11776000 2000
158456055 Jimanbanashi B May 25, 2022, 6:59 p.m. OK Python 2 TESTS 94 124 716800 2000
158456227 r57shell B May 25, 2022, 7 p.m. OK Python 3 TESTS 94 139 307200 2000
158438654 qwerty787788 B May 25, 2022, 6:12 p.m. OK Rust 2021 TESTS 94 31 1228800 2000

remove filters

Back to search problems