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"Homer has two friends Alice and Bob. Both of them are string fans. One day, Alice and Bob decide to play a game on a string s = s_1 s_2 ... s_n of length n consisting of lowercase English letters. They move in turns alternatively and Alice makes the first move. In a move, a player must choose an index i ( 1 <= q i <= q n ) that has not been chosen before, and change s_i to any other lowercase English letter c that c neq s_i . When all indices have been chosen, the game ends. The goal of Alice is to make the final string lexicographically as small as possible, while the goal of Bob is to make the final string lexicographically as large as possible. Both of them are game experts, so they always play games optimally. Homer is not a game expert, so he wonders what the final string will be. A string a is lexicographically smaller than a string b if and only if one of the following holds: Each test contains multiple test cases. The first line contains t ( 1 <= t <= 1000 ) -- the number of test cases. Description of the test cases follows. The only line of each test case contains a single string s ( 1 <= q |s| <= q 50 ) consisting of lowercase English letters. For each test case, print the final string in a single line. In the first test case: Alice makes the first move and must change the only letter to a different one, so she changes it to 'b'. In the second test case: Alice changes the first letter to 'a', then Bob changes the second letter to 'z', Alice changes the third letter to 'a' and then Bob changes the fourth letter to 'z'. In the third test case: Alice changes the first letter to 'b', and then Bob changes the second letter to 'y'. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
106850140 |
fishcathu. |
A |
Feb. 7, 2021, 7:15 p.m. |
OK |
GNU C++11 |
TESTS |
61 |
15 |
0 |
|
|
106870468 |
Krystallos |
A |
Feb. 8, 2021, 4 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
30 |
0 |
|
|
106869623 |
Nash2829 |
A |
Feb. 8, 2021, 3:45 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
30 |
0 |
|
|
106866313 |
sidiangongyuan |
A |
Feb. 8, 2021, 2:42 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
30 |
0 |
|
|
106864040 |
tbw831 |
A |
Feb. 8, 2021, 1:42 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
30 |
0 |
|
|
106846907 |
carolestrella |
A |
Feb. 7, 2021, 6:51 p.m. |
OK |
GNU C++11 |
TESTS |
61 |
30 |
0 |
|
|
106878143 |
Emanon |
A |
Feb. 8, 2021, 5:52 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
31 |
0 |
|
|
106878068 |
coder_hk47 |
A |
Feb. 8, 2021, 5:51 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
31 |
0 |
|
|
106878033 |
Hosea |
A |
Feb. 8, 2021, 5:51 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
31 |
0 |
|
|
106877998 |
twoSig |
A |
Feb. 8, 2021, 5:50 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
31 |
0 |
|
|
106870930 |
K_thread |
A |
Feb. 8, 2021, 4:08 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
30 |
0 |
|
|
106878843 |
Spring |
A |
Feb. 8, 2021, 6:01 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106878733 |
neelangshu_nath |
A |
Feb. 8, 2021, 6 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106878509 |
Aakriti_tulika |
A |
Feb. 8, 2021, 5:57 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106878270 |
u1904123 |
A |
Feb. 8, 2021, 5:54 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106878132 |
Christian_Grey |
A |
Feb. 8, 2021, 5:52 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106877874 |
MDA_11 |
A |
Feb. 8, 2021, 5:49 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106877450 |
mr_nobody0 |
A |
Feb. 8, 2021, 5:43 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106877091 |
since1998 |
A |
Feb. 8, 2021, 5:39 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
106876895 |
rraj0511 |
A |
Feb. 8, 2021, 5:36 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
31 |
0 |
|
|
remove filters
Back to search problems