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'After rejecting 10^{100} data structure problems, Errorgorn is very angry at Anton and decided to kill him. Anton 's DNA can be represented as a string a which only contains the characters "ANTON" (there are only 4 distinct characters). Errorgorn can change Anton 's DNA into string b which must be a permutation of a . However, Anton 's body can defend against this attack. In 1 second, his body can swap 2 adjacent characters of his DNA to transform it back to a . Anton 's body is smart and will use the minimum number of moves. To maximize the chance of Anton dying, Errorgorn wants to change Anton 's DNA the string that maximizes the time for Anton 's body to revert his DNA. But since Errorgorn is busy making more data structure problems, he needs your help to find the best string B . Can you help him? The first line of input contains a single integer t (1 <= q t <= q 100000) -- the number of testcases. The first and only line of each testcase contains 1 string a ( 1 <= q |a| <= q 100000 ). a consists of only the characters "A", "N", "O" and "T". It is guaranteed that the sum of |a| over all testcases does not exceed 100000 . For each testcase, print a single string, b . If there are multiple answers, you can output any one of them. b must be a permutation of the string a . For the first testcase, it takes 7 seconds for Anton 's body to transform NNOTA to ANTON: NNOTA to NNOAT to NNAOT to NANOT to NANTO to ANNTO to ANTNO to ANTON. Note that you cannot output strings such as AANTON, ANTONTRYGUB, AAAAA and anton as it is not a permutation of ANTON. For the second testcase, it takes 2 seconds for Anton 's body to transform AANN to NAAN. Note that other strings such as NNAA and ANNA will also be accepted. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
117717592 |
bucket_xv |
D |
May 29, 2021, 2:37 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
30 |
2150400 |
|
|
117726187 |
fishcathu. |
D |
May 29, 2021, 4:59 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
46 |
102400 |
|
|
117721589 |
dagexiangdani |
D |
May 29, 2021, 3:52 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
46 |
102400 |
|
|
117711401 |
cunzai_zsy0531 |
D |
May 29, 2021, 12:27 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
77 |
512000 |
|
|
117712924 |
zxjk |
D |
May 29, 2021, 1:15 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
78 |
307200 |
|
|
117714912 |
XiKanDaoShuQianChongLang |
D |
May 29, 2021, 1:36 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
78 |
2560000 |
|
|
117721257 |
czyer |
D |
May 29, 2021, 3:46 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
78 |
2867200 |
|
|
117687425 |
pikapikachu |
D |
May 28, 2021, 5:22 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
93 |
204800 |
|
|
117709566 |
askd |
D |
May 28, 2021, 11:05 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
93 |
2457600 |
|
|
117712698 |
gary88 |
D |
May 29, 2021, 1:10 a.m. |
OK |
GNU C++11 |
TESTS |
48 |
124 |
2457600 |
|
|
117715762 |
SuperJ6 |
D |
May 29, 2021, 1:56 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
61 |
614400 |
|
|
117719427 |
nandonathaniel |
D |
May 29, 2021, 3:13 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
62 |
512000 |
|
|
117715548 |
Mr-leng |
D |
May 29, 2021, 1:52 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
78 |
1843200 |
|
|
117718362 |
Cupids_Bow |
D |
May 29, 2021, 2:53 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
93 |
102400 |
|
|
117719376 |
liyuankai |
D |
May 29, 2021, 3:12 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
109 |
3072000 |
|
|
117687190 |
conan_0 |
D |
May 28, 2021, 5:20 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
124 |
1433600 |
|
|
117685453 |
Narset |
D |
May 28, 2021, 5:11 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
140 |
11468800 |
|
|
117696657 |
docflex |
D |
May 28, 2021, 6:40 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
171 |
819200 |
|
|
117685418 |
G_X_J |
D |
May 28, 2021, 5:11 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
171 |
3481600 |
|
|
117725317 |
RNGUmp9 |
D |
May 29, 2021, 4:48 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
327 |
307200 |
|
|
117712428 |
mihaelj |
D |
May 29, 2021, 1:02 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
31 |
409600 |
|
|
117694256 |
fatemetmhr |
D |
May 28, 2021, 6:16 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
46 |
1126400 |
|
|
117684933 |
hhhhxc |
D |
May 28, 2021, 5:10 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
46 |
3379200 |
|
|
117731756 |
StelaYuri |
D |
May 29, 2021, 6 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
61 |
409600 |
|
|
117719856 |
ZEFFERSKIOICH |
D |
May 29, 2021, 3:21 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
61 |
2662400 |
|
|
117685372 |
user14767553 |
D |
May 28, 2021, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
62 |
409600 |
|
|
117716378 |
fgvjkshuifd |
D |
May 29, 2021, 2:11 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
77 |
307200 |
|
|
117729990 |
Boti |
D |
May 29, 2021, 5:41 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
77 |
2662400 |
|
|
117723585 |
yungyao |
D |
May 29, 2021, 4:24 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
93 |
307200 |
|
|
117698775 |
rgnerdplayer |
D |
May 28, 2021, 7:05 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
93 |
307200 |
|
|
117695896 |
JovanB |
D |
May 28, 2021, 6:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
31 |
409600 |
|
|
117695416 |
JovanB |
D |
May 28, 2021, 6:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
46 |
409600 |
|
|
117694493 |
clam |
D |
May 28, 2021, 6:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
46 |
614400 |
|
|
117686616 |
IceKnight1093 |
D |
May 28, 2021, 5:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
46 |
921600 |
|
|
117685528 |
IceKnight1093 |
D |
May 28, 2021, 5:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
46 |
921600 |
|
|
117721284 |
youtsuha |
D |
May 29, 2021, 3:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
46 |
4198400 |
|
|
117695830 |
JovanB |
D |
May 28, 2021, 6:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
61 |
409600 |
|
|
117701889 |
otera |
D |
May 28, 2021, 7:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
62 |
409600 |
|
|
117699255 |
neal |
D |
May 28, 2021, 7:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
62 |
409600 |
|
|
117727185 |
___dreamer__ |
D |
May 29, 2021, 5:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
62 |
716800 |
|
|
117731264 |
Airflow |
D |
May 29, 2021, 5:55 a.m. |
OK |
Haskell |
TESTS |
48 |
935 |
26419200 |
|
|
117688710 |
bobbilyking |
D |
May 28, 2021, 5:30 p.m. |
OK |
Java 11 |
TESTS |
48 |
389 |
0 |
|
|
117697106 |
_merlin_ |
D |
May 28, 2021, 6:45 p.m. |
OK |
Java 11 |
TESTS |
48 |
530 |
16281600 |
|
|
117725452 |
nick_301 |
D |
May 29, 2021, 4:50 a.m. |
OK |
Java 11 |
TESTS |
48 |
546 |
921600 |
|
|
117685498 |
robinz62 |
D |
May 28, 2021, 5:11 p.m. |
OK |
Java 11 |
TESTS |
48 |
967 |
512000 |
|
|
117688291 |
ypa |
D |
May 28, 2021, 5:28 p.m. |
OK |
Java 11 |
TESTS |
48 |
1201 |
0 |
|
|
117694102 |
martins |
D |
May 28, 2021, 6:15 p.m. |
OK |
Java 11 |
TESTS |
48 |
1980 |
5427200 |
|
|
117702959 |
Whiplash99 |
D |
May 28, 2021, 8:07 p.m. |
OK |
Java 8 |
TESTS |
48 |
405 |
0 |
|
|
117721095 |
aggarwalanshul01 |
D |
May 29, 2021, 3:43 a.m. |
OK |
Java 8 |
TESTS |
48 |
1247 |
1536000 |
|
|
117701238 |
PavelChadnov |
D |
May 28, 2021, 7:40 p.m. |
OK |
Kotlin |
TESTS |
48 |
545 |
1945600 |
|
|
117703589 |
Pogger |
D |
May 28, 2021, 8:19 p.m. |
OK |
Kotlin |
TESTS |
48 |
1107 |
5734400 |
|
|
117684821 |
baep_j |
D |
May 28, 2021, 5:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
48 |
436 |
3891200 |
|
|
117723424 |
zwliew |
D |
May 29, 2021, 4:21 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
592 |
9932800 |
|
|
117705399 |
silvertint |
D |
May 28, 2021, 8:56 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
920 |
14336000 |
|
|
117702377 |
codicon |
D |
May 28, 2021, 7:57 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
951 |
11161600 |
|
|
117702300 |
codicon |
D |
May 28, 2021, 7:56 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
982 |
11161600 |
|
|
117719687 |
zwliew |
D |
May 29, 2021, 3:18 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
1419 |
11878400 |
|
|
117719663 |
zwliew |
D |
May 29, 2021, 3:17 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
1481 |
12288000 |
|
|
117720809 |
zwliew |
D |
May 29, 2021, 3:38 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
1543 |
9728000 |
|
|
117697809 |
rpashuto |
D |
May 28, 2021, 6:53 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
1543 |
9728000 |
|
|
117719703 |
zwliew |
D |
May 29, 2021, 3:18 a.m. |
OK |
PyPy 3 |
TESTS |
48 |
1575 |
11673600 |
|
|
117686476 |
errorgorn |
D |
May 28, 2021, 5:16 p.m. |
OK |
PyPy 3 |
TESTS |
48 |
1590 |
9728000 |
|
|
remove filters
Back to search problems