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'Suppose you are given two strings a and b . You can apply the following operation any number of times: choose any contiguous substring of a or b , and sort the characters in it in non-descending order. Let f(a, b) the minimum number of operations you have to apply in order to make them equal (or f(a, b) = 1337 if it is impossible to make a and b equal using these operations). For example: You are given n strings s_1, s_2, ... , s_k having equal length. Calculate sum limits_{i = 1}^{n} sum limits_{j = i + 1}^{n} f(s_i, s_j) . The first line contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of strings. Then n lines follow, each line contains one of the strings s_i , consisting of lowercase Latin letters. |s_1| = |s_2| = ldots = |s_n| , and n cdot |s_1| <= 2 cdot 10^5 . All these strings are pairwise distinct. Print one integer: sum limits_{i = 1}^{n} sum limits_{j = i + 1}^{n} f(s_i, s_j) . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
118440920 |
Ayanami_desu |
F |
June 4, 2021, 4:42 p.m. |
OK |
GNU C++11 |
TESTS |
63 |
186 |
858521600 |
|
|
118463609 |
Newbie_Rainbow_sjy |
F |
June 5, 2021, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
63 |
202 |
124313600 |
|
|
118464291 |
randop |
F |
June 5, 2021, 2:13 a.m. |
OK |
GNU C++11 |
TESTS |
63 |
1340 |
506982400 |
|
|
118440237 |
anon_123coder |
F |
June 4, 2021, 4:38 p.m. |
OK |
GNU C++14 |
TESTS |
63 |
218 |
27443200 |
|
|
118453422 |
dlalswp25 |
F |
June 4, 2021, 7:12 p.m. |
OK |
GNU C++14 |
TESTS |
63 |
405 |
50380800 |
|
|
118467458 |
Hs-Black |
F |
June 5, 2021, 3:37 a.m. |
OK |
GNU C++14 |
TESTS |
63 |
421 |
95948800 |
|
|
118466162 |
tzxydby |
F |
June 5, 2021, 3:02 a.m. |
OK |
GNU C++14 |
TESTS |
63 |
592 |
34918400 |
|
|
118465692 |
eexyz |
F |
June 5, 2021, 2:49 a.m. |
OK |
GNU C++14 |
TESTS |
63 |
889 |
95129600 |
|
|
118465138 |
eexyz |
F |
June 5, 2021, 2:38 a.m. |
OK |
GNU C++14 |
TESTS |
63 |
935 |
117043200 |
|
|
118460682 |
eexyz |
F |
June 4, 2021, 10:59 p.m. |
OK |
GNU C++14 |
TESTS |
63 |
1029 |
117043200 |
|
|
118467718 |
AlexFetisov |
F |
June 5, 2021, 3:44 a.m. |
OK |
GNU C++17 |
TESTS |
63 |
124 |
34406400 |
|
|
118462547 |
RainAir |
F |
June 5, 2021, 12:54 a.m. |
OK |
GNU C++17 |
TESTS |
63 |
155 |
76492800 |
|
|
118450438 |
Rafi22 |
F |
June 4, 2021, 6:23 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
171 |
75980800 |
|
|
118443276 |
HF-Sunny |
F |
June 4, 2021, 4:59 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
202 |
27443200 |
|
|
118441703 |
omkaracharekar |
F |
June 4, 2021, 4:47 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
202 |
27443200 |
|
|
118456451 |
maximumSHOT |
F |
June 4, 2021, 8:12 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
233 |
60416000 |
|
|
118456471 |
maximumSHOT |
F |
June 4, 2021, 8:13 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
233 |
61747200 |
|
|
118434959 |
He_Ren |
F |
June 4, 2021, 4:23 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
311 |
67481600 |
|
|
118441849 |
DeadPillow |
F |
June 4, 2021, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
327 |
104243200 |
|
|
118441664 |
DeadPillow |
F |
June 4, 2021, 4:47 p.m. |
OK |
GNU C++17 |
TESTS |
63 |
327 |
104243200 |
|
|
118441871 |
hitonanode |
F |
June 4, 2021, 4:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
109 |
15052800 |
|
|
118441783 |
noshi91 |
F |
June 4, 2021, 4:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
155 |
22118400 |
|
|
118441216 |
smiken |
F |
June 4, 2021, 4:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
218 |
34918400 |
|
|
118435057 |
pikel_rik |
F |
June 4, 2021, 4:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
280 |
65536000 |
|
|
118433252 |
fastmath |
F |
June 4, 2021, 4:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
296 |
40857600 |
|
|
118433910 |
cuiaoxiang |
F |
June 4, 2021, 4:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
311 |
3686400 |
|
|
118465113 |
WeakestTopology |
F |
June 5, 2021, 2:37 a.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
358 |
5324800 |
|
|
118442351 |
cmwqf |
F |
June 4, 2021, 4:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
358 |
138956800 |
|
|
118460052 |
OleschY |
F |
June 4, 2021, 10:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
374 |
6860800 |
|
|
118468604 |
wlzhouzhuan |
F |
June 5, 2021, 4:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
63 |
389 |
174080000 |
|
|
118442580 |
uwi |
F |
June 4, 2021, 4:53 p.m. |
OK |
Java 11 |
TESTS |
63 |
1731 |
16486400 |
|
|
remove filters
Back to search problems