Codeforces Round 832 (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
1747 Codeforces Round 832 (Div. 2) FINISHED False 7200 69693863 Nov. 4, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 23658 ) B BAN BAN PROGRAMMING constructive algorithms

B'You are given an integer n . Let 's define s(n) as the string "BAN" concatenated n times. For example, s(1) = "BAN", s(3) = "BANBANBAN". Note that the length of the string s(n) is equal to 3n . Consider s(n) . You can perform the following operation on s(n) any number of times (possibly zero): You want the string "BAN" to not appear in s(n) as a subsequence. What 's the smallest number of operations you have to do to achieve this? Also, find one such shortest sequence of operations. A string a is a subsequence of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters. The input consists of multiple test cases. The first line contains a single integer t (1 <= q t <= q 100) -- the number of test cases. The description of the test cases follows. The only line of each test case contains a single integer n (1 <= q n <= q 100) . For each test case, in the first line output m ( 0 <= m <= 10^5 ) -- the minimum number of operations required. It 's guaranteed that the objective is always achievable in at most 10^5 operations under the constraints of the problem. Then, output m lines. The k -th of these lines should contain two integers i_k , j_k (1 <= q i_k, j_k <= q 3n, i_k ne j_k) denoting that you want to swap characters at indices i_k and j_k at the k -th operation. After all m operations, "BAN" must not appear in s(n) as a subsequence. If there are multiple possible answers, output any. In the first testcase, s(1) = "BAN", we can swap s(1)_1 and s(1)_2 , converting s(1) to "ABN", which does not contain "BAN" as a subsequence. In the second testcase, s(2) = "BANBAN", we can swap s(2)_2 and s(2)_6 , converting s(2) to "BNNBAA", which does not contain "BAN" as a subsequence. '...

Tutorials

Codeforces Round #832 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
179349072 ansergeyg B Nov. 5, 2022, 4:56 a.m. OK C# 8 TESTS 3 62 614400
179346551 bluemegane B Nov. 5, 2022, 4:20 a.m. OK C# 8 TESTS 3 92 819200
179351300 bluemegane B Nov. 5, 2022, 5:23 a.m. OK C# 8 TESTS 3 93 204800
179345298 55open B Nov. 5, 2022, 4:01 a.m. OK Clang++17 Diagnostics TESTS 3 30 0
179294544 FlyingFeather B Nov. 4, 2022, 5:40 p.m. OK Clang++20 Diagnostics TESTS 3 77 0
179282213 Priyanshu21407 B Nov. 4, 2022, 4:30 p.m. OK GNU C11 TESTS 3 15 0
179292488 Lastxuan_ B Nov. 4, 2022, 5:30 p.m. OK GNU C11 TESTS 3 15 0
179297324 N20070 B Nov. 4, 2022, 5:55 p.m. OK GNU C11 TESTS 3 30 0
179326984 SAFIN07 B Nov. 4, 2022, 9:22 p.m. OK GNU C11 TESTS 3 31 0
179370617 getputchar B Nov. 5, 2022, 5:49 a.m. OK GNU C11 TESTS 3 31 0
179344213 Cloud09 B Nov. 5, 2022, 3:44 a.m. OK GNU C11 TESTS 3 31 0
179342155 chenjjjrrr B Nov. 5, 2022, 3:10 a.m. OK GNU C11 TESTS 3 31 0
179341400 chenjjjrrr B Nov. 5, 2022, 2:57 a.m. OK GNU C11 TESTS 3 31 0
179337142 lanjiu B Nov. 5, 2022, 1:42 a.m. OK GNU C11 TESTS 3 31 0
179334494 mrgaolll B Nov. 5, 2022, 12:31 a.m. OK GNU C11 TESTS 3 31 0
179347129 taihoang B Nov. 5, 2022, 4:28 a.m. OK GNU C++14 TESTS 3 0 0
179371140 FSPINDLE B Nov. 5, 2022, 5:55 a.m. OK GNU C++14 TESTS 3 0 0
179370446 ___Aditya___ B Nov. 5, 2022, 5:48 a.m. OK GNU C++14 TESTS 3 0 0
179370048 0703w B Nov. 5, 2022, 5:43 a.m. OK GNU C++14 TESTS 3 0 0
179350867 addycoder0110 B Nov. 5, 2022, 5:18 a.m. OK GNU C++14 TESTS 3 0 0
179349923 Xiaoruolii B Nov. 5, 2022, 5:07 a.m. OK GNU C++14 TESTS 3 0 0
179349380 bijalwan_2000 B Nov. 5, 2022, 5 a.m. OK GNU C++14 TESTS 3 0 0
179348883 arpitsri_33 B Nov. 5, 2022, 4:53 a.m. OK GNU C++14 TESTS 3 0 0
179348600 980798778 B Nov. 5, 2022, 4:50 a.m. OK GNU C++14 TESTS 3 0 0
179348094 UnEmperor B Nov. 5, 2022, 4:42 a.m. OK GNU C++14 TESTS 3 0 0
179352611 dhruvg13 B Nov. 5, 2022, 5:38 a.m. OK GNU C++17 TESTS 3 0 0
179352652 Saurabhh02 B Nov. 5, 2022, 5:38 a.m. OK GNU C++17 TESTS 3 0 0
179363909 luli_luli B Nov. 5, 2022, 5:41 a.m. OK GNU C++17 TESTS 3 0 0
179370087 Sam_173 B Nov. 5, 2022, 5:44 a.m. OK GNU C++17 TESTS 3 0 0
179370405 Anurag_51 B Nov. 5, 2022, 5:47 a.m. OK GNU C++17 TESTS 3 0 0
179370427 sjmf B Nov. 5, 2022, 5:47 a.m. OK GNU C++17 TESTS 3 0 0
179370497 aasim3101 B Nov. 5, 2022, 5:48 a.m. OK GNU C++17 TESTS 3 0 0
179370921 requi3m B Nov. 5, 2022, 5:52 a.m. OK GNU C++17 TESTS 3 0 0
179371342 Ashes2001 B Nov. 5, 2022, 5:57 a.m. OK GNU C++17 TESTS 3 0 0
179371689 toomatho B Nov. 5, 2022, 6 a.m. OK GNU C++17 TESTS 3 0 0
179346226 pritmonpara1204 B Nov. 5, 2022, 4:15 a.m. OK GNU C++17 (64) TESTS 3 0 0
179340548 ankit-SM B Nov. 5, 2022, 2:44 a.m. OK GNU C++17 (64) TESTS 3 0 0
179339542 jisanahmed10667 B Nov. 5, 2022, 2:28 a.m. OK GNU C++17 (64) TESTS 3 0 0
179336297 wygzgyw B Nov. 5, 2022, 1:21 a.m. OK GNU C++17 (64) TESTS 3 0 0
179335455 killer_queen4804 B Nov. 5, 2022, 12:58 a.m. OK GNU C++17 (64) TESTS 3 0 0
179334721 xhgua B Nov. 5, 2022, 12:38 a.m. OK GNU C++17 (64) TESTS 3 0 0
179330716 TLE. B Nov. 4, 2022, 10:36 p.m. OK GNU C++17 (64) TESTS 3 0 0
179346597 Utsav-Ladani B Nov. 5, 2022, 4:21 a.m. OK GNU C++17 (64) TESTS 3 0 0
179330081 Ayalla B Nov. 4, 2022, 10:21 p.m. OK GNU C++17 (64) TESTS 3 0 0
179329291 Nivita B Nov. 4, 2022, 10:04 p.m. OK GNU C++17 (64) TESTS 3 0 0
179370638 vedant_1 B Nov. 5, 2022, 5:49 a.m. OK GNU C++20 (64) TESTS 3 0 0
179371953 hari03 B Nov. 5, 2022, 6:03 a.m. OK GNU C++20 (64) TESTS 3 0 0
179371706 Sushobhan_4 B Nov. 5, 2022, 6 a.m. OK GNU C++20 (64) TESTS 3 0 0
179371684 neerajp7 B Nov. 5, 2022, 6 a.m. OK GNU C++20 (64) TESTS 3 0 0
179371452 ugotthewrongidea B Nov. 5, 2022, 5:58 a.m. OK GNU C++20 (64) TESTS 3 0 0
179371220 Arctic_Clam B Nov. 5, 2022, 5:56 a.m. OK GNU C++20 (64) TESTS 3 0 0
179371044 vikash46719 B Nov. 5, 2022, 5:54 a.m. OK GNU C++20 (64) TESTS 3 0 0
179370945 Makzert B Nov. 5, 2022, 5:53 a.m. OK GNU C++20 (64) TESTS 3 0 0
179370313 choco_lava B Nov. 5, 2022, 5:46 a.m. OK GNU C++20 (64) TESTS 3 0 0
179370234 akshaynigam90 B Nov. 5, 2022, 5:45 a.m. OK GNU C++20 (64) TESTS 3 0 0
179307496 saiharish B Nov. 4, 2022, 6:49 p.m. OK Java 11 TESTS 3 155 0
179305477 sduMamutbekov B Nov. 4, 2022, 6:38 p.m. OK Java 11 TESTS 3 156 0
179338330 Yousef_Badr B Nov. 5, 2022, 2:06 a.m. OK Java 11 TESTS 3 171 0
179325017 henrychenOutlook B Nov. 4, 2022, 8:55 p.m. OK Java 11 TESTS 3 171 0
179291923 Spidey2182 B Nov. 4, 2022, 5:28 p.m. OK Java 11 TESTS 3 171 0
179314718 yadavdipesh B Nov. 4, 2022, 7:27 p.m. OK Java 11 TESTS 3 186 0
179293546 Yousef_Badr B Nov. 4, 2022, 5:35 p.m. OK Java 11 TESTS 3 186 0
179331276 ac9117033 B Nov. 4, 2022, 10:50 p.m. OK Java 11 TESTS 3 187 0
179292820 amanpatel23 B Nov. 4, 2022, 5:32 p.m. OK Java 11 TESTS 3 187 0
179343892 P_key25dec B Nov. 5, 2022, 3:39 a.m. OK Java 11 TESTS 3 187 19251200
179307003 Ibrahim027 B Nov. 4, 2022, 6:47 p.m. OK Java 17 TESTS 3 202 0
179292070 abhayptsr B Nov. 4, 2022, 5:29 p.m. OK Java 17 TESTS 3 202 409600
179312440 malaydewangan310 B Nov. 4, 2022, 7:13 p.m. OK Java 17 TESTS 3 202 512000
179283495 dheer2000 B Nov. 4, 2022, 4:32 p.m. OK Java 17 TESTS 3 217 1228800
179306065 MisterTryHard B Nov. 4, 2022, 6:41 p.m. OK Java 17 TESTS 3 218 1126400
179299614 NiteshSingh2301 B Nov. 4, 2022, 6:06 p.m. OK Java 17 TESTS 3 233 0
179313695 simoneponginibbio B Nov. 4, 2022, 7:21 p.m. OK Java 17 TESTS 3 233 204800
179284101 Ankit_chaubey B Nov. 4, 2022, 4:33 p.m. OK Java 17 TESTS 3 233 307200
179335349 code_my_way123 B Nov. 5, 2022, 12:55 a.m. OK Java 17 TESTS 3 233 1024000
179314488 Suraj1607 B Nov. 4, 2022, 7:26 p.m. OK Java 17 TESTS 3 233 1024000
179293642 gssakash B Nov. 4, 2022, 5:36 p.m. OK Java 8 TESTS 3 77 0
179282195 Rolex_shivam B Nov. 4, 2022, 4:30 p.m. OK Java 8 TESTS 3 78 0
179292156 NerfThis B Nov. 4, 2022, 5:29 p.m. OK Java 8 TESTS 3 78 0
179338482 SoKee_USTC B Nov. 5, 2022, 2:09 a.m. OK Java 8 TESTS 3 92 0
179322538 rish1896 B Nov. 4, 2022, 8:27 p.m. OK Java 8 TESTS 3 93 0
179292435 youtsuha B Nov. 4, 2022, 5:30 p.m. OK Java 8 TESTS 3 93 0
179333335 KingOfLiu B Nov. 4, 2022, 11:49 p.m. OK Java 8 TESTS 3 108 0
179289404 Rayhan_07 B Nov. 4, 2022, 5:18 p.m. OK Java 8 TESTS 3 108 0
179341098 imsd_14 B Nov. 5, 2022, 2:53 a.m. OK Java 8 TESTS 3 109 0
179351081 frey4 B Nov. 5, 2022, 5:20 a.m. OK Java 8 TESTS 3 109 0
179333074 Faber B Nov. 4, 2022, 11:39 p.m. OK Kotlin 1.6 TESTS 3 202 0
179292218 bestgreenie B Nov. 4, 2022, 5:29 p.m. OK MS C++ 2017 TESTS 3 0 0
179283883 hxrushing12 B Nov. 4, 2022, 4:33 p.m. OK MS C++ 2017 TESTS 3 15 0
179346622 wawawawa1 B Nov. 5, 2022, 4:21 a.m. OK MS C++ 2017 TESTS 3 30 0
179279155 Sushi0077 B Nov. 4, 2022, 4:23 p.m. OK MS C++ 2017 TESTS 3 30 0
179343953 hkwu6013 B Nov. 5, 2022, 3:40 a.m. OK PyPy 3 TESTS 3 77 2867200
179292563 akashbhoi B Nov. 4, 2022, 5:31 p.m. OK PyPy 3 TESTS 3 108 5427200
179340955 jash93 B Nov. 5, 2022, 2:50 a.m. OK PyPy 3 TESTS 3 109 3891200
179316233 abc_noob B Nov. 4, 2022, 7:38 p.m. OK PyPy 3 TESTS 3 109 4710400
179320668 abc_noob_backup B Nov. 4, 2022, 8:09 p.m. OK PyPy 3 TESTS 3 109 4710400
179321063 abc_noob_backup B Nov. 4, 2022, 8:12 p.m. OK PyPy 3 TESTS 3 124 4710400
179279096 gs3122 B Nov. 4, 2022, 4:22 p.m. OK PyPy 3 TESTS 3 124 5120000
179279043 jaguar_f_type_v8 B Nov. 4, 2022, 4:22 p.m. OK PyPy 3 TESTS 3 140 5222400
179292377 golo B Nov. 4, 2022, 5:30 p.m. OK PyPy 3 TESTS 3 217 8089600
179305023 zouyu9631 B Nov. 4, 2022, 6:36 p.m. OK PyPy 3-64 TESTS 3 62 2662400
179278897 Adilkhan21 B Nov. 4, 2022, 4:22 p.m. OK PyPy 3-64 TESTS 3 62 3174400
179304897 nchu21201519-wsj B Nov. 4, 2022, 6:35 p.m. OK PyPy 3-64 TESTS 3 62 3584000
179293264 Shlok007 B Nov. 4, 2022, 5:34 p.m. OK PyPy 3-64 TESTS 3 62 4096000
179325085 merium B Nov. 4, 2022, 8:56 p.m. OK PyPy 3-64 TESTS 3 77 3379200
179304711 nchu21201519-wsj B Nov. 4, 2022, 6:34 p.m. OK PyPy 3-64 TESTS 3 77 3584000
179336972 Nan-Do B Nov. 5, 2022, 1:38 a.m. OK PyPy 3-64 TESTS 3 77 4608000
179341760 liuaaa B Nov. 5, 2022, 3:03 a.m. OK PyPy 3-64 TESTS 3 77 4710400
179311133 beofrosty B Nov. 4, 2022, 7:05 p.m. OK PyPy 3-64 TESTS 3 77 4710400
179290150 relixer B Nov. 4, 2022, 5:21 p.m. OK PyPy 3-64 TESTS 3 77 4710400
179335204 milimurmu1995 B Nov. 5, 2022, 12:51 a.m. OK Python 3 TESTS 3 30 0
179296133 Dinesh_devanaboina B Nov. 4, 2022, 5:48 p.m. OK Python 3 TESTS 3 30 0
179336122 160220a007 B Nov. 5, 2022, 1:17 a.m. OK Python 3 TESTS 3 31 0
179331075 kartikdk B Nov. 4, 2022, 10:45 p.m. OK Python 3 TESTS 3 31 0
179329758 lemoon_05 B Nov. 4, 2022, 10:13 p.m. OK Python 3 TESTS 3 31 0
179327111 Mirali B Nov. 4, 2022, 9:24 p.m. OK Python 3 TESTS 3 31 0
179307669 vishnesh B Nov. 4, 2022, 6:50 p.m. OK Python 3 TESTS 3 31 0
179307156 lukerry B Nov. 4, 2022, 6:48 p.m. OK Python 3 TESTS 3 31 0
179343095 NS3081992 B Nov. 5, 2022, 3:26 a.m. OK Python 3 TESTS 3 31 102400
179351343 PartinGQAQ B Nov. 5, 2022, 5:23 a.m. OK Python 3 TESTS 3 46 0
179293072 sakikuroe B Nov. 4, 2022, 5:33 p.m. OK Rust 2021 TESTS 3 30 0
179338090 tongtongac B Nov. 5, 2022, 2:01 a.m. OK Rust 2021 TESTS 3 31 0

remove filters

Back to search problems