Codeforces Round 915 (Div. 2)

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
1905 Codeforces Round 915 (Div. 2) FINISHED False 7200 34442663 Dec. 16, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12767 ) C Largest Subsequence PROGRAMMING data structures greedy strings

B"Given is a string s of length n . In one operation you can select the lexicographically largest ^ dagger subsequence of string s and cyclic shift it to the right ^ ddagger . Your task is to calculate the minimum number of operations it would take for s to become sorted, or report that it never reaches a sorted state. ^ dagger A string a is lexicographically smaller than a string b if and only if one of the following holds: ^ ddagger By cyclic shifting the string t_1t_2 ldots t_m to the right, we get the string t_mt_1 ldots t_{m-1} . Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of the string s . The second line of each test case contains a single string s of length n , consisting of lowercase English letters. It is guaranteed that sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the minimum number of operations required to make s sorted, or -1 if it's impossible. In the first test case, the string s is already sorted, so we need no operations. In the second test case, doing one operation, we will select cb and cyclic shift it. The string s is now abc which is sorted. In the third test case, s cannot be sorted. In the fourth test case we will perform the following operations: Thus, we need 2 operations. "...

Tutorials

Codeforces Round 915 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
237548084 Letmecry C Dec. 16, 2023, 8:13 p.m. OK C# 10 TESTS 9 92 3686400
237523164 Teen121 C Dec. 16, 2023, 4:25 p.m. OK C# 10 TESTS 9 124 4505600
237518560 Alfafox C Dec. 16, 2023, 4:11 p.m. OK C# 10 TESTS 9 124 5529600
237554892 NenadDapic C Dec. 16, 2023, 10:32 p.m. OK FPC TESTS 9 62 3993600
237522778 ruban C Dec. 16, 2023, 4:24 p.m. OK FPC TESTS 9 155 254566400
237570561 pash18i5 C Dec. 17, 2023, 5:31 a.m. OK GNU C11 TESTS 9 62 1843200
237570207 pash18i5 C Dec. 17, 2023, 5:25 a.m. OK GNU C11 TESTS 9 93 1843200
237532838 MegalovaniaJ C Dec. 16, 2023, 5:22 p.m. OK GNU C++14 TESTS 9 15 819200
237521706 JA2012 C Dec. 16, 2023, 4:20 p.m. OK GNU C++14 TESTS 9 15 921600
237572184 hekaiyu C Dec. 17, 2023, 5:56 a.m. OK GNU C++14 TESTS 9 15 1228800
237533884 huangxi C Dec. 16, 2023, 5:32 p.m. OK GNU C++14 TESTS 9 15 1228800
237559716 restar682 C Dec. 17, 2023, 1:33 a.m. OK GNU C++14 TESTS 9 15 1331200
237524751 doctor049 C Dec. 16, 2023, 4:29 p.m. OK GNU C++14 TESTS 9 15 1433600
237551117 aarsh.kaushik123 C Dec. 16, 2023, 9:05 p.m. OK GNU C++14 TESTS 9 15 1536000
237528756 naveeee C Dec. 16, 2023, 4:56 p.m. OK GNU C++14 TESTS 9 15 1536000
237559498 kkksa01 C Dec. 17, 2023, 1:25 a.m. OK GNU C++14 TESTS 9 15 1843200
237569405 JHSeng C Dec. 17, 2023, 5:12 a.m. OK GNU C++14 TESTS 9 15 2662400
237529022 DarthCoder33 C Dec. 16, 2023, 4:57 p.m. OK GNU C++17 TESTS 9 15 819200
237535372 khanayaan7 C Dec. 16, 2023, 5:46 p.m. OK GNU C++17 TESTS 9 15 1024000
237528804 atharv825 C Dec. 16, 2023, 4:57 p.m. OK GNU C++17 TESTS 9 15 1024000
237523445 james_067 C Dec. 16, 2023, 4:26 p.m. OK GNU C++17 TESTS 9 15 1024000
237522672 yzkkai C Dec. 16, 2023, 4:23 p.m. OK GNU C++17 TESTS 9 15 1024000
237517034 RayhanSefat1332 C Dec. 16, 2023, 4:07 p.m. OK GNU C++17 TESTS 9 15 1024000
237516020 MoonLight_18 C Dec. 16, 2023, 4:04 p.m. OK GNU C++17 TESTS 9 15 1024000
237514711 ruoan C Dec. 16, 2023, 4 p.m. OK GNU C++17 TESTS 9 15 1024000
237536759 udits0999 C Dec. 16, 2023, 5:59 p.m. OK GNU C++17 TESTS 9 15 1024000
237537319 AndrewSeven C Dec. 16, 2023, 6:04 p.m. OK GNU C++17 TESTS 9 15 1024000
237561015 SAYEM_16 C Dec. 17, 2023, 2:08 a.m. OK GNU C++17 (64) TESTS 9 0 4505600
237563762 huangbq198 C Dec. 17, 2023, 3:15 a.m. OK GNU C++17 (64) TESTS 9 15 1024000
237563799 Sparkle_Twilight C Dec. 17, 2023, 3:16 a.m. OK GNU C++17 (64) TESTS 9 15 1024000
237519683 syz_ C Dec. 16, 2023, 4:15 p.m. OK GNU C++17 (64) TESTS 9 15 1228800
237515697 Jeziorop C Dec. 16, 2023, 4:03 p.m. OK GNU C++17 (64) TESTS 9 15 1228800
237516738 Piper_ C Dec. 16, 2023, 4:06 p.m. OK GNU C++17 (64) TESTS 9 15 1331200
237558037 nguyenhonganh2357 C Dec. 17, 2023, 12:32 a.m. OK GNU C++17 (64) TESTS 9 15 1331200
237517020 wxgmjfhy C Dec. 16, 2023, 4:07 p.m. OK GNU C++17 (64) TESTS 9 15 2150400
237559790 Once_I_Liked_AGirl C Dec. 17, 2023, 1:35 a.m. OK GNU C++17 (64) TESTS 9 15 2150400
237518730 Pirate_King_Luffy C Dec. 16, 2023, 4:12 p.m. OK GNU C++17 (64) TESTS 9 15 2252800
237552492 Better.Call.Vee C Dec. 16, 2023, 9:32 p.m. OK GNU C++20 (64) TESTS 9 0 819200
237544750 NtwoO C Dec. 16, 2023, 7:26 p.m. OK GNU C++20 (64) TESTS 9 0 819200
237522992 FH13 C Dec. 16, 2023, 4:24 p.m. OK GNU C++20 (64) TESTS 9 0 1228800
237560561 yswooo C Dec. 17, 2023, 1:56 a.m. OK GNU C++20 (64) TESTS 9 0 2355200
237564222 hanifchdn C Dec. 17, 2023, 3:26 a.m. OK GNU C++20 (64) TESTS 9 0 2355200
237528668 Solxce C Dec. 16, 2023, 4:56 p.m. OK GNU C++20 (64) TESTS 9 0 2355200
237544476 shreyam7713 C Dec. 16, 2023, 7:22 p.m. OK GNU C++20 (64) TESTS 9 0 4505600
237531120 schmosby C Dec. 16, 2023, 5:09 p.m. OK GNU C++20 (64) TESTS 9 15 512000
237540364 MixxCP3 C Dec. 16, 2023, 6:34 p.m. OK GNU C++20 (64) TESTS 9 15 512000
237542903 AbhayAnilark C Dec. 16, 2023, 7:03 p.m. OK GNU C++20 (64) TESTS 9 15 512000
237518209 wzl722 C Dec. 16, 2023, 4:10 p.m. OK Go TESTS 9 31 8601600
237515943 botayhard C Dec. 16, 2023, 4:04 p.m. OK Go TESTS 9 46 16691200
237533048 foolcoder C Dec. 16, 2023, 5:24 p.m. OK Java 11 TESTS 9 171 0
237565823 achal5623 C Dec. 17, 2023, 3:59 a.m. OK Java 11 TESTS 9 248 1638400
237523994 naitik.ntn2001 C Dec. 16, 2023, 4:27 p.m. OK Java 11 TESTS 9 249 0
237518082 yashvardhan3 C Dec. 16, 2023, 4:10 p.m. OK Java 11 TESTS 9 265 5836800
237522084 abigailzhou03 C Dec. 16, 2023, 4:22 p.m. OK Java 11 TESTS 9 280 2867200
237519489 C_nena_E C Dec. 16, 2023, 4:14 p.m. OK Java 11 TESTS 9 311 1843200
237515315 2110039467 C Dec. 16, 2023, 4:02 p.m. OK Java 11 TESTS 9 311 5836800
237526693 Abhishek2003a C Dec. 16, 2023, 4:34 p.m. OK Java 11 TESTS 9 327 0
237522941 klu_2100030969 C Dec. 16, 2023, 4:24 p.m. OK Java 11 TESTS 9 342 6758400
237524385 Bhavishya.teki C Dec. 16, 2023, 4:28 p.m. OK Java 11 TESTS 9 358 5836800
237524777 mlangc C Dec. 16, 2023, 4:29 p.m. OK Java 17 TESTS 9 202 102400
237541176 Mamimi C Dec. 16, 2023, 6:42 p.m. OK Java 17 TESTS 9 202 819200
237571283 Harwinvanak C Dec. 17, 2023, 5:42 a.m. OK Java 17 TESTS 9 202 10956800
237537652 Aditya_Trivedi1 C Dec. 16, 2023, 6:07 p.m. OK Java 17 TESTS 9 218 2662400
237564202 nis1234 C Dec. 17, 2023, 3:25 a.m. OK Java 17 TESTS 9 218 5939200
237537014 daksh_02 C Dec. 16, 2023, 6:01 p.m. OK Java 17 TESTS 9 233 3788800
237536985 dakshkhullar14 C Dec. 16, 2023, 6:01 p.m. OK Java 17 TESTS 9 233 3788800
237524260 aris_sk C Dec. 16, 2023, 4:28 p.m. OK Java 17 TESTS 9 249 6348800
237524865 r3hab.rs C Dec. 16, 2023, 4:30 p.m. OK Java 17 TESTS 9 249 7577600
237535284 999ms_Clutch C Dec. 16, 2023, 5:45 p.m. OK Java 17 TESTS 9 265 44441600
237571744 RkRohitKumar C Dec. 17, 2023, 5:49 a.m. OK Java 21 TESTS 9 296 2867200
237555825 MinaMagdy1 C Dec. 16, 2023, 11:02 p.m. OK Java 21 TESTS 9 311 4198400
237518817 Samyajit125 C Dec. 16, 2023, 4:12 p.m. OK Java 21 TESTS 9 343 12902400
237551024 antumbra C Dec. 16, 2023, 9:03 p.m. OK Java 21 TESTS 9 358 6656000
237525764 diegofdz333 C Dec. 16, 2023, 4:32 p.m. OK Java 21 TESTS 9 358 7987200
237524867 2100031426klu C Dec. 16, 2023, 4:30 p.m. OK Java 21 TESTS 9 436 6144000
237537764 pratap.S007 C Dec. 16, 2023, 6:08 p.m. OK Java 21 TESTS 9 655 7577600
237530214 himanshubhardwaj169 C Dec. 16, 2023, 5:03 p.m. OK Java 8 TESTS 9 109 0
237529793 _ShenHua_ C Dec. 16, 2023, 5:01 p.m. OK Java 8 TESTS 9 124 0
237516876 abhayrajnegi0416 C Dec. 16, 2023, 4:06 p.m. OK Java 8 TESTS 9 124 1126400
237533211 NerfThis C Dec. 16, 2023, 5:25 p.m. OK Java 8 TESTS 9 124 1331200
237526455 yadavDipesh C Dec. 16, 2023, 4:33 p.m. OK Java 8 TESTS 9 155 0
237516855 Clxc C Dec. 16, 2023, 4:06 p.m. OK Java 8 TESTS 9 186 1126400
237521253 chiragsingh876 C Dec. 16, 2023, 4:19 p.m. OK Java 8 TESTS 9 202 1228800
237543867 Akarsh2810 C Dec. 16, 2023, 7:14 p.m. OK Java 8 TESTS 9 202 4096000
237531562 naitikvarshney C Dec. 16, 2023, 5:12 p.m. OK Java 8 TESTS 9 217 13516800
237556047 Sumitsingh7 C Dec. 16, 2023, 11:11 p.m. OK Java 8 TESTS 9 233 42496000
237524001 arvindf232 C Dec. 16, 2023, 4:27 p.m. OK Kotlin 1.6 TESTS 9 748 20582400
237530351 samestimable2016 C Dec. 16, 2023, 5:04 p.m. OK Kotlin 1.9 TESTS 9 467 51814400
237518589 desecrater C Dec. 16, 2023, 4:11 p.m. OK Kotlin 1.9 TESTS 9 888 90521600
237515729 Samarth_Raj_ C Dec. 16, 2023, 4:03 p.m. OK Mono C# TESTS 9 171 13516800
237553424 NajlSadek C Dec. 16, 2023, 9:52 p.m. OK MS C++ 2017 TESTS 9 62 3481600
237517919 chayan.surana3 C Dec. 16, 2023, 4:09 p.m. OK MS C++ 2017 TESTS 9 77 2764800
237519742 rsFalse C Dec. 16, 2023, 4:15 p.m. OK Perl TESTS 9 764 37990400
237532832 rsFalse C Dec. 16, 2023, 5:22 p.m. OK Perl TESTS 9 826 38092800
237525919 Lakshmi_Rishitha C Dec. 16, 2023, 4:32 p.m. OK PHP TESTS 9 108 29388800
237569814 amitjoshi24 C Dec. 17, 2023, 5:19 a.m. OK PyPy 3 TESTS 9 186 26521600
237515876 sebalexschott C Dec. 16, 2023, 4:04 p.m. OK PyPy 3 TESTS 9 233 14950400
237551618 khanter_ C Dec. 16, 2023, 9:14 p.m. OK PyPy 3 TESTS 9 233 31744000
237521858 Rohit_94 C Dec. 16, 2023, 4:21 p.m. OK PyPy 3 TESTS 9 374 14438400
237515954 xfp_17 C Dec. 16, 2023, 4:04 p.m. OK PyPy 3 TESTS 9 374 16281600
237520042 apru_02 C Dec. 16, 2023, 4:16 p.m. OK PyPy 3 TESTS 9 436 14336000
237534725 muichirotokito C Dec. 16, 2023, 5:40 p.m. OK PyPy 3 TESTS 9 436 15257600
237521880 xKRISHNAx C Dec. 16, 2023, 4:21 p.m. OK PyPy 3 TESTS 9 607 16691200
237549121 SamuelTull C Dec. 16, 2023, 8:29 p.m. OK PyPy 3-64 TESTS 9 93 9523200
237557118 SamuelTull C Dec. 16, 2023, 11:53 p.m. OK PyPy 3-64 TESTS 9 108 21094400
237557061 SamuelTull C Dec. 16, 2023, 11:51 p.m. OK PyPy 3-64 TESTS 9 108 21094400
237557202 SamuelTull C Dec. 16, 2023, 11:55 p.m. OK PyPy 3-64 TESTS 9 124 21094400
237550171 AndreiZherder C Dec. 16, 2023, 8:48 p.m. OK PyPy 3-64 TESTS 9 139 17715200
237556966 SamuelTull C Dec. 16, 2023, 11:47 p.m. OK PyPy 3-64 TESTS 9 139 21094400
237529297 CinaDor C Dec. 16, 2023, 4:58 p.m. OK PyPy 3-64 TESTS 9 139 21708800
237531724 poornaTheja C Dec. 16, 2023, 5:13 p.m. OK PyPy 3-64 TESTS 9 139 29184000
237549861 kinglykang C Dec. 16, 2023, 8:42 p.m. OK PyPy 3-64 TESTS 9 155 21811200
237531441 Hossam_Hassan_Taher C Dec. 16, 2023, 5:11 p.m. OK PyPy 3-64 TESTS 9 155 24473600
237515173 yeling C Dec. 16, 2023, 4:02 p.m. OK Python 3 TESTS 9 124 7680000
237541742 lapras100 C Dec. 16, 2023, 6:49 p.m. OK Python 3 TESTS 9 155 12800000
237532729 sahibsemahegn.sh C Dec. 16, 2023, 5:21 p.m. OK Python 3 TESTS 9 155 21504000
237515355 im_gh C Dec. 16, 2023, 4:02 p.m. OK Python 3 TESTS 9 171 13312000
237524427 OCamlEnjoyer C Dec. 16, 2023, 4:28 p.m. OK Python 3 TESTS 9 186 10956800
237520093 spark_M C Dec. 16, 2023, 4:16 p.m. OK Python 3 TESTS 9 187 13107200
237529478 zhdanovich C Dec. 16, 2023, 4:59 p.m. OK Python 3 TESTS 9 202 5017600
237540690 parashar22475 C Dec. 16, 2023, 6:37 p.m. OK Python 3 TESTS 9 202 12083200
237538252 jvatsal0709 C Dec. 16, 2023, 6:13 p.m. OK Python 3 TESTS 9 202 14438400
237528851 Mati_Y C Dec. 16, 2023, 4:57 p.m. OK Python 3 TESTS 9 202 26828800
237547259 vstiff C Dec. 16, 2023, 8:01 p.m. OK Rust 2021 TESTS 9 62 3379200
237548727 vstiff C Dec. 16, 2023, 8:22 p.m. OK Rust 2021 TESTS 9 93 2764800
237515776 points_engineering C Dec. 16, 2023, 4:03 p.m. OK Rust 2021 TESTS 9 108 5632000
237525007 liut C Dec. 16, 2023, 4:30 p.m. OK Rust 2021 TESTS 9 124 8908800

remove filters

Back to search problems