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 |
---|---|---|---|---|---|---|
1699 | Codeforces Round 804 (Div. 2) | FINISHED | False | 7200 | 80321062 | July 4, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3201 ) | D | Almost Triple Deletions | PROGRAMMING | data structures dp greedy |
B'You are given an integer n and an array a_1,a_2, ldots,a_n . In one operation, you can choose an index i ( 1 <= i lt n ) for which a_i neq a_{i+1} and delete both a_i and a_{i+1} from the array. After deleting a_i and a_{i+1} , the remaining parts of the array are concatenated. For example, if a=[1,4,3,3,6,2] , then after performing an operation with i=2 , the resulting array will be [1,3,6,2] . What is the maximum possible length of an array of equal elements obtainable from a by performing several (perhaps none) of the aforementioned operations? Each test contains multiple test cases. The first line of input contains one integer t ( 1 <= t <= 1000 ) -- the number of test cases. The following lines contain the descriptions of the test cases. The first line of each test case contains a single integer n ( 1 <= n <= 5000 ) -- the length of array a . The second line of each test case contains n integers a_1,a_2, ldots,a_n ( 1 <= a_i <= n ) -- the elements of array a . It is guaranteed that the sum of n across all test cases does not exceed 10 ,000 . For each testcase, print a single integer, the maximum possible length of an array of equal elements obtainable from a by performing a sequence of operations. For the first testcase, an optimal sequence of operations would be: [1,2,3,2,1,3,3] rightarrow [3,2,1,3,3] rightarrow [3,3,3] . For the second testcase, all elements in the array are already equal. For the third testcase, the only possible sequence of operations is: [1,1,1,2,2,2] rightarrow [1,1,2,2] rightarrow [1,2] rightarrow [] . Note that, according to the statement, the elements deleted at each step must be different. For the fourth testcase, the optimal sequence of operations is: [1,1,2,2,3,3,1,1] rightarrow [1,1,2,3,1,1] rightarrow [1,1,1,1] . For the fifth testcase, one possible rea'... |
Codeforces Round #804 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
162851435 | gla_201599020 | D | July 5, 2022, 5:08 a.m. | OK | Clang++20 Diagnostics | TESTS | 45 | 1185 | 204800 | ||
162853415 | CodeRikka | D | July 5, 2022, 5:38 a.m. | OK | GNU C++14 | TESTS | 45 | 46 | 102400 | ||
162850082 | sicupu | D | July 5, 2022, 4:45 a.m. | OK | GNU C++14 | TESTS | 45 | 46 | 102400 | ||
162854563 | KihoMaaya | D | July 5, 2022, 5:55 a.m. | OK | GNU C++14 | TESTS | 45 | 46 | 102400 | ||
162842955 | peterpi23 | D | July 5, 2022, 2:45 a.m. | OK | GNU C++14 | TESTS | 45 | 46 | 102400 | ||
162844705 | Sz_zUwu | D | July 5, 2022, 3:14 a.m. | OK | GNU C++14 | TESTS | 45 | 46 | 102400 | ||
162851378 | JA2012 | D | July 5, 2022, 5:07 a.m. | OK | GNU C++14 | TESTS | 45 | 46 | 1126400 | ||
162834784 | Paqis | D | July 4, 2022, 11:39 p.m. | OK | GNU C++14 | TESTS | 45 | 61 | 102400 | ||
162806117 | peter112358 | D | July 4, 2022, 4:29 p.m. | OK | GNU C++14 | TESTS | 43 | 61 | 102400 | ||
162797085 | Xavskia | D | July 4, 2022, 3:56 p.m. | OK | GNU C++14 | TESTS | 43 | 62 | 0 | ||
162853491 | CodeRikka | D | July 5, 2022, 5:39 a.m. | OK | GNU C++14 | TESTS | 45 | 62 | 102400 | ||
162854537 | vjudge4 | D | July 5, 2022, 5:55 a.m. | OK | GNU C++17 | TESTS | 45 | 46 | 102400 | ||
162851888 | woyaobianshengle | D | July 5, 2022, 5:15 a.m. | OK | GNU C++17 | TESTS | 45 | 46 | 102400 | ||
162817141 | Bobocan | D | July 4, 2022, 6:13 p.m. | OK | GNU C++17 | TESTS | 44 | 46 | 614400 | ||
162813330 | Star_Dream | D | July 4, 2022, 5:28 p.m. | OK | GNU C++17 | TESTS | 44 | 46 | 2560000 | ||
162806064 | Hofl | D | July 4, 2022, 4:29 p.m. | OK | GNU C++17 | TESTS | 43 | 46 | 3891200 | ||
162797719 | Aggu_01000101 | D | July 4, 2022, 3:58 p.m. | OK | GNU C++17 | TESTS | 43 | 61 | 102400 | ||
162844790 | HinanawiTenshi | D | July 5, 2022, 3:15 a.m. | OK | GNU C++17 | TESTS | 45 | 61 | 204800 | ||
162851478 | LRL52 | D | July 5, 2022, 5:09 a.m. | OK | GNU C++17 | TESTS | 45 | 61 | 2150400 | ||
162841740 | WrongAutomaton | D | July 5, 2022, 2:24 a.m. | OK | GNU C++17 | TESTS | 45 | 61 | 2457600 | ||
162842534 | windy7926778 | D | July 5, 2022, 2:38 a.m. | OK | GNU C++17 | TESTS | 45 | 62 | 0 | ||
162841711 | asd12 | D | July 5, 2022, 2:23 a.m. | OK | GNU C++17 (64) | TESTS | 45 | 61 | 102400 | ||
162844745 | keziaaurelia | D | July 5, 2022, 3:14 a.m. | OK | GNU C++17 (64) | TESTS | 45 | 62 | 102400 | ||
162838750 | ImHubery | D | July 5, 2022, 1:26 a.m. | OK | GNU C++17 (64) | TESTS | 45 | 62 | 102400 | ||
162837834 | 542007220117 | D | July 5, 2022, 1:08 a.m. | OK | GNU C++17 (64) | TESTS | 45 | 62 | 102400 | ||
162837230 | orzdevinwang | D | July 5, 2022, 12:52 a.m. | OK | GNU C++17 (64) | TESTS | 45 | 62 | 102400 | ||
162828949 | thehunterjames | D | July 4, 2022, 9:09 p.m. | OK | GNU C++17 (64) | TESTS | 44 | 62 | 102400 | ||
162810513 | hoainiem | D | July 4, 2022, 5:01 p.m. | OK | GNU C++17 (64) | TESTS | 44 | 62 | 102400 | ||
162804347 | retiredd | D | July 4, 2022, 4:23 p.m. | OK | GNU C++17 (64) | TESTS | 43 | 62 | 102400 | ||
162799006 | gqf123 | D | July 4, 2022, 4:02 p.m. | OK | GNU C++17 (64) | TESTS | 43 | 62 | 102400 | ||
162798843 | Lucina | D | July 4, 2022, 4:02 p.m. | OK | GNU C++17 (64) | TESTS | 43 | 62 | 102400 | ||
162840239 | dalek114514 | D | July 5, 2022, 1:55 a.m. | OK | GNU C++20 (64) | TESTS | 45 | 46 | 102400 | ||
162851711 | LuluOwO | D | July 5, 2022, 5:12 a.m. | OK | GNU C++20 (64) | TESTS | 45 | 46 | 102400 | ||
162847598 | xuem7294 | D | July 5, 2022, 3:59 a.m. | OK | GNU C++20 (64) | TESTS | 45 | 46 | 102400 | ||
162841786 | xiaoru | D | July 5, 2022, 2:25 a.m. | OK | GNU C++20 (64) | TESTS | 45 | 46 | 102400 | ||
162840287 | Mercuryyy | D | July 5, 2022, 1:57 a.m. | OK | GNU C++20 (64) | TESTS | 45 | 46 | 102400 | ||
162822199 | islingr | D | July 4, 2022, 7:21 p.m. | OK | GNU C++20 (64) | TESTS | 44 | 46 | 102400 | ||
162822170 | islingr | D | July 4, 2022, 7:21 p.m. | OK | GNU C++20 (64) | TESTS | 44 | 46 | 102400 | ||
162819621 | Tiagodfs | D | July 4, 2022, 6:44 p.m. | OK | GNU C++20 (64) | TESTS | 44 | 46 | 102400 | ||
162816475 | islingr | D | July 4, 2022, 6:05 p.m. | OK | GNU C++20 (64) | TESTS | 44 | 46 | 102400 | ||
162812486 | joker_x | D | July 4, 2022, 5:19 p.m. | OK | GNU C++20 (64) | TESTS | 44 | 46 | 102400 | ||
162843469 | Prince_Nandha | D | July 5, 2022, 2:54 a.m. | OK | Java 11 | TESTS | 45 | 358 | 0 | ||
162852532 | dzhi | D | July 5, 2022, 5:25 a.m. | OK | Java 11 | TESTS | 45 | 545 | 42598400 | ||
162853808 | naman5811 | D | July 5, 2022, 5:44 a.m. | OK | Java 11 | TESTS | 45 | 670 | 161382400 | ||
162802504 | profchi | D | July 4, 2022, 4:15 p.m. | OK | Java 11 | TESTS | 43 | 1326 | 259891200 | ||
162829073 | freehandle | D | July 4, 2022, 9:13 p.m. | OK | Java 17 | TESTS | 44 | 295 | 614400 | ||
162831579 | freehandle | D | July 4, 2022, 10:05 p.m. | OK | Java 17 | TESTS | 44 | 312 | 614400 | ||
162806123 | earl_of_byteland | D | July 4, 2022, 4:29 p.m. | OK | Java 17 | TESTS | 43 | 872 | 157286400 | ||
162853405 | cftauros | D | July 5, 2022, 5:38 a.m. | OK | Java 8 | TESTS | 45 | 374 | 41574400 | ||
162836569 | MagentaCobra | D | July 5, 2022, 12:36 a.m. | OK | Java 8 | TESTS | 45 | 639 | 145715200 | ||
162823810 | ktropin | D | July 4, 2022, 7:44 p.m. | OK | Mono C# | TESTS | 44 | 1638 | 58675200 | ||
162845657 | Superlau | D | July 5, 2022, 3:28 a.m. | OK | MS C++ 2017 | TESTS | 45 | 62 | 102400 | ||
162821482 | anishde85 | D | July 4, 2022, 7:12 p.m. | OK | PyPy 3 | TESTS | 44 | 623 | 12083200 | ||
162821276 | anishde85 | D | July 4, 2022, 7:09 p.m. | OK | PyPy 3 | TESTS | 44 | 623 | 12083200 | ||
162805206 | keroru | D | July 4, 2022, 4:26 p.m. | OK | PyPy 3 | TESTS | 43 | 1153 | 211251200 | ||
162812770 | mkawa2 | D | July 4, 2022, 5:22 p.m. | OK | PyPy 3 | TESTS | 44 | 1668 | 12492800 | ||
162844863 | ruimina | D | July 5, 2022, 3:16 a.m. | OK | PyPy 3 | TESTS | 45 | 1887 | 11980800 | ||
162806544 | PMiguelez | D | July 4, 2022, 4:30 p.m. | OK | PyPy 3-64 | TESTS | 43 | 280 | 3481600 | ||
162838272 | MistaAsh | D | July 5, 2022, 1:16 a.m. | OK | PyPy 3-64 | TESTS | 45 | 358 | 8601600 | ||
162849332 | samchen123 | D | July 5, 2022, 4:32 a.m. | OK | PyPy 3-64 | TESTS | 45 | 514 | 8601600 | ||
162843148 | siganai | D | July 5, 2022, 2:48 a.m. | OK | PyPy 3-64 | TESTS | 45 | 1075 | 238796800 | ||
162838169 | CAELO | D | July 5, 2022, 1:14 a.m. | OK | PyPy 3-64 | TESTS | 45 | 1092 | 242073600 | ||
162840547 | verynewabie | D | July 5, 2022, 2:01 a.m. | OK | PyPy 3-64 | TESTS | 45 | 1996 | 243302400 | ||
162811929 | robostac | D | July 4, 2022, 5:13 p.m. | OK | Rust 2021 | TESTS | 44 | 46 | 1024000 | ||
162816069 | Sempr | D | July 4, 2022, 6 p.m. | OK | Rust 2021 | TESTS | 44 | 78 | 204800 | ||
162815771 | Sempr | D | July 4, 2022, 5:57 p.m. | OK | Rust 2021 | TESTS | 44 | 78 | 204800 | ||
162818077 | LittleFall | D | July 4, 2022, 6:25 p.m. | OK | Rust 2021 | TESTS | 44 | 93 | 512000 | ||
162810917 | LittleFall | D | July 4, 2022, 5:04 p.m. | OK | Rust 2021 | TESTS | 44 | 93 | 512000 | ||
162845548 | Thallium54 | D | July 5, 2022, 3:26 a.m. | OK | Rust 2021 | TESTS | 45 | 218 | 26828800 | ||
162810213 | robostac | D | July 4, 2022, 4:59 p.m. | OK | Rust 2021 | TESTS | 44 | 1466 | 1331200 |
Back to search problems