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'This is an easy version of the problem. The actual problems are different, but the easy version is almost a subtask of the hard version. Note that the constraints and the output format are different. You are given a string s consisting of n lowercase Latin letters. You have to color all its characters one of the two colors (each character to exactly one color, the same letters can be colored the same or different colors, i.e. you can choose exactly one color for each index in s ). After coloring, you can swap any two neighboring characters of the string that are colored different colors. You can perform such an operation arbitrary (possibly, zero) number of times. The goal is to make the string sorted, i.e. all characters should be in alphabetical order. Your task is to say if it is possible to color the given string so that after coloring it can become sorted by some sequence of swaps. Note that you have to restore only coloring, not the sequence of swaps. The first line of the input contains one integer n ( 1 <= n <= 200 ) -- the length of s . The second line of the input contains the string s consisting of exactly n lowercase Latin letters. If it is impossible to color the given string so that after coloring it can become sorted by some sequence of swaps, print "NO" (without quotes) in the first line. Otherwise, print "YES" in the first line and any correct coloring in the second line (the coloring is the string consisting of n characters, the i -th character should be '0 ' if the i -th character is colored the first color and '1 ' otherwise). '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
70386560 |
ftiasch |
E1 |
Feb. 5, 2020, 5:58 p.m. |
OK |
D |
TESTS |
48 |
31 |
0 |
|
1800 |
70331844 |
TYGZ |
E1 |
Feb. 5, 2020, 6:12 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
30 |
0 |
|
1800 |
70326403 |
Dzwhzzmcbw63q |
E1 |
Feb. 5, 2020, 3:39 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
30 |
0 |
|
1800 |
70605703 |
Aleks |
E1 |
Feb. 9, 2020, 6:42 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
30 |
0 |
|
1800 |
70561958 |
sokolovivan |
E1 |
Feb. 8, 2020, 12:08 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
30 |
0 |
|
1800 |
71093538 |
vjudge3 |
E1 |
Feb. 15, 2020, 3:26 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
31 |
0 |
|
1800 |
71093513 |
_sherlok |
E1 |
Feb. 15, 2020, 3:26 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
31 |
0 |
|
1800 |
71089207 |
joker_123 |
E1 |
Feb. 14, 2020, 11:43 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
31 |
0 |
|
1800 |
71096071 |
vjudge1 |
E1 |
Feb. 15, 2020, 4:56 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
31 |
0 |
|
1800 |
71034133 |
kkry2333 |
E1 |
Feb. 14, 2020, 4:43 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
31 |
0 |
|
1800 |
71019752 |
bhaktadip |
E1 |
Feb. 13, 2020, 7:52 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
31 |
0 |
|
1800 |
70749210 |
trivediatharva |
E1 |
Feb. 10, 2020, 6:24 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
15 |
0 |
|
1800 |
70560874 |
nghia051 |
E1 |
Feb. 8, 2020, 11:49 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
15 |
0 |
|
1800 |
70445184 |
shreyas_710 |
E1 |
Feb. 6, 2020, 2:58 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
15 |
0 |
|
1800 |
70331969 |
patelcd_23 |
E1 |
Feb. 5, 2020, 6:14 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
15 |
0 |
|
1800 |
70347001 |
wsyhb |
E1 |
Feb. 5, 2020, 9:51 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
15 |
307200 |
|
1800 |
70345383 |
Mihai145 |
E1 |
Feb. 5, 2020, 9:29 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
15 |
1638400 |
|
1800 |
70760852 |
jitto98 |
E1 |
Feb. 11, 2020, 1:18 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
30 |
0 |
|
1800 |
71073796 |
Ninjaclasher reasoned_nuance ChrisT |
E1 |
Feb. 14, 2020, 4:42 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
30 |
0 |
|
1800 |
70929906 |
baobao1702 |
E1 |
Feb. 13, 2020, 4:39 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
30 |
0 |
|
1800 |
70823288 |
house-cat |
E1 |
Feb. 12, 2020, 5:10 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
30 |
0 |
|
1800 |
70465193 |
rajan_ladani |
E1 |
Feb. 6, 2020, 8:10 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70405705 |
noronha |
E1 |
Feb. 6, 2020, 2:02 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70376028 |
idLe. |
E1 |
Feb. 5, 2020, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70368118 |
MichioKaku |
E1 |
Feb. 5, 2020, 2:35 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70353466 |
Trinethra |
E1 |
Feb. 5, 2020, 11:36 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70348452 |
prajwal7868 |
E1 |
Feb. 5, 2020, 10:12 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70299296 |
Atondro_Wahid |
E1 |
Feb. 4, 2020, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
0 |
|
1800 |
70322268 |
calgagi |
E1 |
Feb. 5, 2020, 1:17 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
512000 |
|
1800 |
70337486 |
HeLL_O |
E1 |
Feb. 5, 2020, 7:35 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
15 |
7987200 |
|
1800 |
71076067 |
vjudge3 |
E1 |
Feb. 14, 2020, 5:21 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
30 |
0 |
|
1800 |
70394632 |
bleh0.5 |
E1 |
Feb. 5, 2020, 8:27 p.m. |
OK |
Java 11 |
TESTS |
48 |
171 |
0 |
|
1800 |
70393227 |
namandeept_00 |
E1 |
Feb. 5, 2020, 7:53 p.m. |
OK |
Java 11 |
TESTS |
48 |
171 |
0 |
|
1800 |
70393165 |
Kimo_Fathy |
E1 |
Feb. 5, 2020, 7:52 p.m. |
OK |
Java 11 |
TESTS |
48 |
186 |
0 |
|
1800 |
70387091 |
alankritanand001 |
E1 |
Feb. 5, 2020, 6:05 p.m. |
OK |
Java 11 |
TESTS |
48 |
186 |
0 |
|
1800 |
70581470 |
pennyIsLove |
E1 |
Feb. 8, 2020, 5:20 p.m. |
OK |
Java 11 |
TESTS |
48 |
187 |
0 |
|
1800 |
70391735 |
Anonymous |
E1 |
Feb. 5, 2020, 7:24 p.m. |
OK |
Java 11 |
TESTS |
48 |
187 |
0 |
|
1800 |
70390474 |
namandeept_00 |
E1 |
Feb. 5, 2020, 6:59 p.m. |
OK |
Java 11 |
TESTS |
48 |
187 |
0 |
|
1800 |
70335326 |
Azakarka |
E1 |
Feb. 5, 2020, 7:04 a.m. |
OK |
Java 11 |
TESTS |
48 |
187 |
0 |
|
1800 |
70326563 |
s1052823 |
E1 |
Feb. 5, 2020, 3:45 a.m. |
OK |
Java 11 |
TESTS |
48 |
187 |
0 |
|
1800 |
70295909 |
GiantTornado |
E1 |
Feb. 4, 2020, 4:30 p.m. |
OK |
Java 11 |
TESTS |
48 |
187 |
0 |
|
1800 |
70349708 |
poiuytrewq |
E1 |
Feb. 5, 2020, 10:33 a.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70750010 |
ProfBaltazar |
E1 |
Feb. 10, 2020, 6:40 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70749211 |
paramvirsingh1 |
E1 |
Feb. 10, 2020, 6:24 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70530128 |
Mildog |
E1 |
Feb. 7, 2020, 9:53 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70466162 |
unicorn20141 |
E1 |
Feb. 6, 2020, 8:34 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70435365 |
rahsutamrev |
E1 |
Feb. 6, 2020, 12:44 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70408723 |
manu1996 |
E1 |
Feb. 6, 2020, 4 a.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70405301 |
manu1996 |
E1 |
Feb. 6, 2020, 1:43 a.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70374896 |
Shameek |
E1 |
Feb. 5, 2020, 4:07 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70311090 |
polyakoff |
E1 |
Feb. 4, 2020, 7:14 p.m. |
OK |
Java 8 |
TESTS |
48 |
109 |
0 |
|
1800 |
70356228 |
walborn |
E1 |
Feb. 5, 2020, 12:16 p.m. |
OK |
JavaScript |
TESTS |
48 |
31 |
0 |
|
1800 |
70354728 |
walborn |
E1 |
Feb. 5, 2020, 11:55 a.m. |
OK |
JavaScript |
TESTS |
48 |
46 |
307200 |
|
1800 |
70802009 |
badcw |
E1 |
Feb. 11, 2020, 5:14 p.m. |
OK |
Kotlin |
TESTS |
48 |
109 |
0 |
|
1800 |
70350548 |
SlavaG |
E1 |
Feb. 5, 2020, 10:48 a.m. |
OK |
Kotlin |
TESTS |
48 |
140 |
102400 |
|
1800 |
70338636 |
Spheniscine |
E1 |
Feb. 5, 2020, 7:52 a.m. |
OK |
Kotlin |
TESTS |
48 |
140 |
409600 |
|
1800 |
70298189 |
yakamoto |
E1 |
Feb. 4, 2020, 4:34 p.m. |
OK |
Kotlin |
TESTS |
48 |
155 |
1024000 |
|
1800 |
70376768 |
cjtoribio |
E1 |
Feb. 5, 2020, 4:32 p.m. |
OK |
Kotlin |
TESTS |
48 |
202 |
102400 |
|
1800 |
70616436 |
TrinidadTobago |
E1 |
Feb. 9, 2020, 10:08 a.m. |
OK |
Mono C# |
TESTS |
48 |
62 |
0 |
|
1800 |
70321838 |
shy3205 |
E1 |
Feb. 5, 2020, 12:57 a.m. |
OK |
Mono C# |
TESTS |
48 |
62 |
0 |
|
1800 |
70330329 |
sakapon |
E1 |
Feb. 5, 2020, 5:44 a.m. |
OK |
Mono C# |
TESTS |
48 |
77 |
3891200 |
|
1800 |
70297597 |
truly |
E1 |
Feb. 4, 2020, 4:34 p.m. |
OK |
MS C++ |
TESTS |
48 |
31 |
0 |
|
1800 |
70715888 |
vjudge1 |
E1 |
Feb. 10, 2020, 8:31 a.m. |
OK |
MS C++ |
TESTS |
48 |
31 |
0 |
|
1800 |
70314032 |
mrx_slm |
E1 |
Feb. 4, 2020, 8:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
0 |
|
1800 |
70512743 |
EatingMelonPublic |
E1 |
Feb. 7, 2020, 3:20 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
0 |
|
1800 |
70341186 |
paradoxhzy |
E1 |
Feb. 5, 2020, 8:27 a.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
0 |
|
1800 |
70294752 |
facedawn |
E1 |
Feb. 4, 2020, 4:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
0 |
|
1800 |
70327243 |
iRuIrUI |
E1 |
Feb. 5, 2020, 4:06 a.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
307200 |
|
1800 |
70325332 |
bibibihhh |
E1 |
Feb. 5, 2020, 3:08 a.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
307200 |
|
1800 |
70298324 |
CrashMaster |
E1 |
Feb. 4, 2020, 4:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
307200 |
|
1800 |
70401041 |
AlexanderL |
E1 |
Feb. 5, 2020, 10:04 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
307200 |
|
1800 |
70401237 |
AlexanderL |
E1 |
Feb. 5, 2020, 10:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
307200 |
|
1800 |
70690367 |
WoodMachine |
E1 |
Feb. 9, 2020, 7:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
31 |
307200 |
|
1800 |
70512248 |
reyad |
E1 |
Feb. 7, 2020, 3:12 p.m. |
OK |
PHP |
TESTS |
48 |
46 |
409600 |
|
1800 |
70299418 |
pajenegod |
E1 |
Feb. 4, 2020, 4:43 p.m. |
OK |
PyPy 2 |
TESTS |
48 |
124 |
204800 |
|
1800 |
70332443 |
WhatsCode |
E1 |
Feb. 5, 2020, 6:20 a.m. |
OK |
PyPy 2 |
TESTS |
48 |
155 |
0 |
|
1800 |
70807615 |
codershuvo |
E1 |
Feb. 11, 2020, 7:02 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
0 |
|
1800 |
70680378 |
Lalaleyna |
E1 |
Feb. 9, 2020, 4:37 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
0 |
|
1800 |
70416803 |
megabluejay |
E1 |
Feb. 6, 2020, 7:21 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
0 |
|
1800 |
70407166 |
nishant_ny7 |
E1 |
Feb. 6, 2020, 3:05 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
0 |
|
1800 |
70387410 |
Ormlis |
E1 |
Feb. 5, 2020, 6:10 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
0 |
|
1800 |
70336128 |
vippee |
E1 |
Feb. 5, 2020, 7:15 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
0 |
|
1800 |
70346019 |
vishhesh |
E1 |
Feb. 5, 2020, 9:38 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
1331200 |
|
1800 |
70366019 |
siddhantgarg11 |
E1 |
Feb. 5, 2020, 2:11 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
140 |
1433600 |
|
1800 |
70773958 |
Waiting |
E1 |
Feb. 11, 2020, 8:09 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
155 |
0 |
|
1800 |
70680555 |
Lalaleyna |
E1 |
Feb. 9, 2020, 4:46 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
155 |
0 |
|
1800 |
70680482 |
Lalaleyna |
E1 |
Feb. 9, 2020, 4:42 p.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
0 |
|
1800 |
70680458 |
Lalaleyna |
E1 |
Feb. 9, 2020, 4:41 p.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
0 |
|
1800 |
70543112 |
a_sc |
E1 |
Feb. 8, 2020, 6:36 a.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
0 |
|
1800 |
70390723 |
drpdada |
E1 |
Feb. 5, 2020, 7:04 p.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
0 |
|
1800 |
70441734 |
Shankhadeep |
E1 |
Feb. 6, 2020, 2:13 p.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
307200 |
|
1800 |
70431493 |
programmer_neo |
E1 |
Feb. 6, 2020, 11:39 a.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
307200 |
|
1800 |
70401841 |
sapna_tomar |
E1 |
Feb. 5, 2020, 10:41 p.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
307200 |
|
1800 |
70295033 |
meicholtz |
E1 |
Feb. 4, 2020, 4:28 p.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
307200 |
|
1800 |
70834284 |
NocturneBflat |
E1 |
Feb. 12, 2020, 9:34 a.m. |
OK |
Python 3 |
TESTS |
48 |
109 |
512000 |
|
1800 |
70748662 |
robertrosl |
E1 |
Feb. 10, 2020, 6:12 p.m. |
OK |
Python 3 |
TESTS |
48 |
124 |
0 |
|
1800 |
70610975 |
terraformer |
E1 |
Feb. 9, 2020, 8:25 a.m. |
OK |
Rust |
TESTS |
48 |
31 |
0 |
|
1800 |
70300563 |
sansen |
E1 |
Feb. 4, 2020, 4:52 p.m. |
OK |
Rust |
TESTS |
48 |
31 |
0 |
|
1800 |
remove filters
Back to search problems