Codeforces Round 1095 (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
2226 Codeforces Round 1095 (Div. 2) FINISHED False 8100 1178664 April 28, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5876 ) C Mental Monumental (Easy Version) PROGRAMMING binary search data structures greedy math two pointers

This is the easy version of this problem. The difference between the versions is that in this version, you are required to find only the value of (f(a)). For any array (c_1, c_2, \ldots, c_m), we define (f(c)) as the maximum possible (\operatorname{mex}(c))(^{\text{∗}}) that can be achieved by performing the following operation exactly once: Choose an integer array (b_1, b_2, \ldots, b_m) such that (b_i \ge 1) for all (1 \le i \le m); Set (c_i := c_i \, \bmod \, b_i)(^{\text{†}}) for every (1 \le i \le m). You are given an array (a) consisting of (n) non-negative integers. Determine the value of (f(a)). (^{\text{∗}})(\operatorname{mex}(c)) denotes the minimum excluded (MEX) of the integers in (c). For example, (\operatorname{mex}(2,2,1)=0) because (0) does not belong to the array, and (\operatorname{mex}(0,3,1,2)=4) because (0), (1), (2), and (3) appear in the array, but (4) does not. (^{\text{†}})(u \bmod v) denotes the remainder from dividing (u) by (v). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each testcase contains a single integer (n) ((1 \le n \le 2 \cdot 10^5)) — the length of the array (a). The second line of each testcase contains (n) integers (a_1, a_2, \ldots, a_n) ((0 \le a_i \le 10^6)) — the elements of the array (a). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). It is guaranteed that the sum of (\max(a_1,a_2,\ldots,a_n)) over all test cases does not exceed (10^6). For each testcase, output a single integer — the value of (f(a)). For the first testcase, choosing (b = 1, 2, 3, 4) leaves (a) unchanged and we have (\operatorname{mex}(a) = 4). For the second testcase, choosing $$$b

Tutorials

Codeforces Round 1095 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
372863041 sasafied C April 28, 2026, 4:15 p.m. OK C# 10 TESTS 20 390 16486400
372858845 caffeine2ac C April 28, 2026, 4:01 p.m. OK C# 13 TESTS 20 421 110489600
372867145 wadexun C April 28, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 20 93 0
372861654 jiushinanfeng C April 28, 2026, 4:10 p.m. OK C++17 (GCC 7-32) TESTS 20 93 102400
372857726 Mathew76 C April 28, 2026, 3:57 p.m. OK C++17 (GCC 7-32) TESTS 20 93 102400
372884767 bubbarob19 C April 28, 2026, 7:01 p.m. OK C++17 (GCC 7-32) TESTS 20 93 102400
372862855 laxman0413 C April 28, 2026, 4:14 p.m. OK C++17 (GCC 7-32) TESTS 20 93 102400
372901099 yjc981124 C April 29, 2026, 1:35 a.m. OK C++17 (GCC 7-32) TESTS 20 93 2867200
372868270 ZDTSN C April 28, 2026, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
372863382 Arnav_Bansal_546 C April 28, 2026, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 20 109 0
372871421 EatChangmyeong C April 28, 2026, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
372910337 yvzuojianlianzi C April 29, 2026, 5:20 a.m. OK C++17 (GCC 7-32) TESTS 20 109 102400
372903099 Alasco C April 29, 2026, 2:36 a.m. OK C++20 (GCC 13-64) TESTS 20 78 0
372870605 yash_23_03_2006 C April 28, 2026, 4:42 p.m. OK C++20 (GCC 13-64) TESTS 20 78 102400
372864167 thiuwunh C April 28, 2026, 4:19 p.m. OK C++20 (GCC 13-64) TESTS 20 78 5017600
372872336 TerryHorizon98 C April 28, 2026, 4:49 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
372902406 fastsolving C April 29, 2026, 2:15 a.m. OK C++20 (GCC 13-64) TESTS 20 93 0
372893781 Camilo649 C April 28, 2026, 9:22 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
372868965 ChTh01ly C April 28, 2026, 4:36 p.m. OK C++20 (GCC 13-64) TESTS 20 93 0
372872717 Tonq123 C April 28, 2026, 4:49 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
372889788 hyououin9kyouma C April 28, 2026, 8:03 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
372872661 pieterbot C April 28, 2026, 4:49 p.m. OK C++20 (GCC 13-64) TESTS 20 93 102400
372857281 MuchenLi C April 28, 2026, 3:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 0
372856635 RedSalt C April 28, 2026, 3:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 102400
372904052 Ihxnan C April 29, 2026, 2:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 4198400
372890296 Lonely_penguin C April 28, 2026, 8:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 4915200
372859477 morex3 C April 28, 2026, 4:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 5017600
372899825 L1022 C April 29, 2026, 12:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 78 9011200
372900200 Maverick18 C April 29, 2026, 1:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
372908246 Jteh C April 29, 2026, 4:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
372904745 HuTao C April 29, 2026, 3:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
372900649 Why0719 C April 29, 2026, 1:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 93 0
372861670 1435730 C April 28, 2026, 4:10 p.m. OK GNU C11 TESTS 20 125 8806400
372861756 codecrasher_ C April 28, 2026, 4:10 p.m. OK Go TESTS 20 625 11161600
372886058 madhu.korada131 C April 28, 2026, 7:16 p.m. OK Java 21 TESTS 20 250 1945600
372858226 kartikjaju5 C April 28, 2026, 3:59 p.m. OK Java 21 TESTS 20 265 819200
372871673 madhu.korada131 C April 28, 2026, 4:46 p.m. OK Java 21 TESTS 20 265 1843200
372864390 raj03 C April 28, 2026, 4:19 p.m. OK Java 21 TESTS 20 281 716800
372864009 Spencer1s C April 28, 2026, 4:18 p.m. OK Java 21 TESTS 20 296 1433600
372866419 yadavrajakran854 C April 28, 2026, 4:27 p.m. OK Java 21 TESTS 20 296 1740800
372884255 dinddinddind C April 28, 2026, 6:54 p.m. OK Java 21 TESTS 20 296 3379200
372857813 pieande C April 28, 2026, 3:57 p.m. OK Java 21 TESTS 20 312 614400
372871354 AbdelAchbani C April 28, 2026, 4:45 p.m. OK Java 21 TESTS 20 312 716800
372870429 __0xCk__ C April 28, 2026, 4:42 p.m. OK Java 21 TESTS 20 312 716800
372901097 public-static-void-main C April 29, 2026, 1:35 a.m. OK Java 8 TESTS 20 218 32153600
372859138 niteshkaushik200 C April 28, 2026, 4:02 p.m. OK Java 8 TESTS 20 234 4300800
372871667 br0kecoder C April 28, 2026, 4:46 p.m. OK Java 8 TESTS 20 453 6041600
372855473 ACE243153 C April 28, 2026, 3:50 p.m. OK Java 8 TESTS 20 734 409600
372871661 tohoshinki254 C April 28, 2026, 4:46 p.m. OK Java 8 TESTS 20 765 15564800
372865111 bitplease_ C April 28, 2026, 4:22 p.m. OK Node.js TESTS 20 625 71065600
372881643 pipylon C April 28, 2026, 6:26 p.m. OK PyPy 3 TESTS 20 421 15667200
372870272 rafsimons C April 28, 2026, 4:41 p.m. OK PyPy 3 TESTS 20 421 16179200
372872292 anose C April 28, 2026, 4:48 p.m. OK PyPy 3 TESTS 20 921 24166400
372857641 Akshar_7 C April 28, 2026, 3:57 p.m. OK PyPy 3-64 TESTS 20 203 21094400
372864221 rich_chanel C April 28, 2026, 4:19 p.m. OK PyPy 3-64 TESTS 20 218 26931200
372859670 tassei903 C April 28, 2026, 4:04 p.m. OK PyPy 3-64 TESTS 20 218 32460800
372857320 AKIDNAR C April 28, 2026, 3:56 p.m. OK PyPy 3-64 TESTS 20 234 24268800
372862541 tttgggccc C April 28, 2026, 4:13 p.m. OK PyPy 3-64 TESTS 20 234 26419200
372856150 weii2000 C April 28, 2026, 3:52 p.m. OK PyPy 3-64 TESTS 20 234 26931200
372856445 1521a C April 28, 2026, 3:53 p.m. OK PyPy 3-64 TESTS 20 234 31027200
372855937 eugenechka.boyko.2_0-0 C April 28, 2026, 3:52 p.m. OK PyPy 3-64 TESTS 20 234 33280000
372907217 chmpro C April 29, 2026, 4:16 a.m. OK PyPy 3-64 TESTS 20 250 35737600
372880554 GoldbangE C April 28, 2026, 6:15 p.m. OK PyPy 3-64 TESTS 20 281 27238400
372863943 harsha_jagu C April 28, 2026, 4:18 p.m. OK Python 3 TESTS 20 1078 53862400
372857617 HarshitGupta314 C April 28, 2026, 3:57 p.m. OK Python 3 TESTS 20 1281 23347200
372895769 Abhi222 C April 28, 2026, 10:19 p.m. OK Python 3 TESTS 20 1281 23756800
372856333 mahendra3421 C April 28, 2026, 3:53 p.m. OK Python 3 TESTS 20 1421 22630400
372856713 YUHUI-YUHUI C April 28, 2026, 3:54 p.m. OK Python 3 TESTS 20 1453 70553600
372871226 Eigencoder C April 28, 2026, 4:45 p.m. OK Python 3 TESTS 20 1578 33177600
372868306 sgaotj2024 C April 28, 2026, 4:34 p.m. OK Python 3 TESTS 20 1640 34201600
372888248 Geforce_RTX_4090 C April 28, 2026, 7:40 p.m. OK Python 3 TESTS 20 1781 23756800
372856156 surgicalbyte C April 28, 2026, 3:52 p.m. OK Python 3 TESTS 20 2718 29900800
372859249 DarkWeB10 C April 28, 2026, 4:02 p.m. OK Python 3 TESTS 20 2734 28979200
372866108 rejwar C April 28, 2026, 4:26 p.m. OK Rust 2024 TESTS 20 78 12800000
372858061 Siddham_N C April 28, 2026, 3:58 p.m. OK Rust 2024 TESTS 20 93 14131200
372862410 trycatchcry C April 28, 2026, 4:13 p.m. OK Rust 2024 TESTS 20 93 16588800

remove filters

Back to search problems