Educational Codeforces Round 187 (Rated for 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
2203 Educational Codeforces Round 187 (Rated for Div. 2) FINISHED False 7200 4375523 Feb. 25, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 398 ) F Binary Search with One Swap PROGRAMMING binary search divide and conquer dp hashing math

Consider the following algorithm for searching for an integer (x) in an array (a) of length (n), where the elements are numbered from (1) to (n): initialize (l = 1) and (r = n); if (l \gt r), terminate the algorithm and report that the desired element was not found; compute (m = \lfloor \frac{l + r}{2} \rfloor); if (a_m = x), terminate the algorithm and report that the desired element was found; if (a_m \lt x), set (l = m + 1), otherwise set (r = m - 1); go to step (2). It can be shown that if the array (a) is sorted in non-decreasing order, then any element of (a) will be successfully found by this algorithm. Your task is as follows: for a given number (n), consider all pairs ((i, j)) such that (1 \le i \lt j \le n). For each of these pairs, you need to calculate its beauty — the number of integers (x) from (1) to (n) that can be successfully found by the described algorithm if we take the array (a = 1, 2, 3, \dots, n) and swap the elements (a_i) and (a_j). After that, for each (k) from (0) to (n), you need to output (p_k) — the number of pairs with beauty (k). The only line of the input contains one integer (n) ((3 \le n \le 5 \cdot 10^6)). Print (n+1) integers (p_0, p_1, \dots, p_n), where (p_k) is the number of pairs ((i, j)) with beauty (k). Consider an example where (n = 4): if we swap (a_1) and (a_2), then (1), (3), and (4) can be successfully found; if we swap (a_1) and (a_3), then (2) and (4) can be successfully found; if we swap (a_2) and (a_3), then (1), (3), and (4) can be successfully found; if we swap (a_1) and (a_4), then (2) and (3) can be successfully found; if we swap (a_2) and (a_4), then (1) and (4) can be successfully found; if we swap (a_3) and (a_4), then (1), (2), and (4) can

Tutorials

Educational Codeforces Round 187 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
364382500 -firefly- F Feb. 25, 2026, 5:08 p.m. OK C# 13 TESTS 13 171 164044800
364374638 gloriali8976 F Feb. 25, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 13 468 120320000
364376975 darkmatter_druid F Feb. 25, 2026, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 13 500 76288000
364433190 doreen129 F Feb. 26, 2026, 5:43 a.m. OK C++17 (GCC 7-32) TESTS 13 718 100249600
364368766 Hidden-Sol F Feb. 25, 2026, 4:15 p.m. OK C++17 (GCC 7-32) TESTS 13 781 100249600
364381434 System_new F Feb. 25, 2026, 5 p.m. OK C++17 (GCC 7-32) TESTS 13 921 216473600
364371299 ShubhamYadav-27 F Feb. 25, 2026, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 13 984 217190400
364384912 potato167 F Feb. 25, 2026, 5:27 p.m. OK C++17 (GCC 7-32) TESTS 13 1062 76185600
364370333 Salamnka F Feb. 25, 2026, 4:19 p.m. OK C++17 (GCC 7-32) TESTS 13 1187 180428800
364373659 luka.heric F Feb. 25, 2026, 4:27 p.m. OK C++17 (GCC 7-32) TESTS 13 1234 356761600
364376981 kenkenken F Feb. 25, 2026, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 13 1250 40140800
364373381 imaiwluv F Feb. 25, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 13 156 117452800
364398416 415411 F Feb. 25, 2026, 7:46 p.m. OK C++20 (GCC 13-64) TESTS 13 250 102297600
364373786 TongMinhTriz F Feb. 25, 2026, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 13 296 40140800
364401146 shendeliliang F Feb. 25, 2026, 8:24 p.m. OK C++20 (GCC 13-64) TESTS 13 296 116428800
364410698 LanceTheDragonTrainer F Feb. 25, 2026, 11:28 p.m. OK C++20 (GCC 13-64) TESTS 13 312 80179200
364377836 CleinCc F Feb. 25, 2026, 4:38 p.m. OK C++20 (GCC 13-64) TESTS 13 328 100249600
364401254 shendeliliang F Feb. 25, 2026, 8:26 p.m. OK C++20 (GCC 13-64) TESTS 13 328 116428800
364377399 Tmitmi F Feb. 25, 2026, 4:34 p.m. OK C++20 (GCC 13-64) TESTS 13 359 116428800
364391627 noya2 F Feb. 25, 2026, 6:28 p.m. OK C++20 (GCC 13-64) TESTS 13 375 216576000
364382664 2516_lord F Feb. 25, 2026, 5:09 p.m. OK C++20 (GCC 13-64) TESTS 13 406 340684800
364388044 ankitraj803120 F Feb. 25, 2026, 5:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 109 59801600
364377239 Robrob09 F Feb. 25, 2026, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 234 56320000
364426325 Zhou_Hang F Feb. 26, 2026, 4:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 13 250 76697600
364395054 MahmoudBassem F Feb. 25, 2026, 7:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 281 80179200
364403534 BLOBVISGOD F Feb. 25, 2026, 8:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 296 40140800
364394817 MahmoudBassem F Feb. 25, 2026, 7:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 296 80281600
364368132 daolam F Feb. 25, 2026, 4:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 312 40140800
364370168 konichi F Feb. 25, 2026, 4:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 312 116531200
364390559 Rantan F Feb. 25, 2026, 6:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 328 76492800
364392351 user23_97 F Feb. 25, 2026, 6:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 328 120320000
364371672 GreedyProof F Feb. 25, 2026, 4:22 p.m. OK Go TESTS 13 78 43622400
364411594 Power_Rangers_ F Feb. 25, 2026, 11:50 p.m. OK Java 21 TESTS 13 1328 436121600
364411787 Power_Rangers_ F Feb. 25, 2026, 11:56 p.m. OK Java 21 TESTS 13 1468 436838400
364370938 NaughtyIndia F Feb. 25, 2026, 4:20 p.m. OK PyPy 3-64 TESTS 13 250 184422400
364380501 gameon030609 F Feb. 25, 2026, 4:54 p.m. OK PyPy 3-64 TESTS 13 828 204595200
364382552 Sugar_fan F Feb. 25, 2026, 5:08 p.m. OK Rust 2024 TESTS 13 984 359219200
364370329 ymy202602 F Feb. 25, 2026, 4:19 p.m. OK Scala TESTS 13 921 274022400

remove filters

Back to search problems