You can use several words in query to find by all of them at the same time. In addition, if you are lucky search understands word forms and some synonyms. It supports search by title and author. Examples:

  • 305 — search for 305, most probably it will find blogs about the Round 305
  • andrew stankevich contests — search for words "andrew", "stankevich" and "contests" at the same time
  • user:mikemirzayanov title:testlib — search containing "testlib" in title by MikeMirzayanov
  • "vk cup" — use quotes to find phrase as is
  • title:educational — search in title

Results

1.

Uniqueness

Last visit:  6 years ago
Registered:  6 years ago
2.
By MikeMirzayanov, history, 2 years ago, In English
Congratulations: Tourist has reached a rating of 4000! Hello, As you may have already noticed, [user:tourist,2024-08-31] has reached the symbolic milestone of 4000 rating points. This is the first time in the history of competitive programming. I, personally, and the entire Codeforces team, congratulate Gennady [user:tourist,2024-08-31] Korotkevich on this incredible achievement! Right now, we have assigned a new rank “Tourist” to the 4+ rating. This highlights the uniqueness of the moment! However, in the future, I would like to change this name to something a bit more neutral (or leave it Tourist?). Would you help me with this? I’d appreciate your cool suggestions in the comments! Here are a few options from me. Please, vote: - Epic Grandmaster - Ultimate Grandmaster - Godlike Grandmaster - Tourist - 4K Grandmaster - Grandmaster 4K - Legendary Grandmaster 4K - Joke option: Ultra HD Grandmaster - from [user:Tlatoani,2024-08-30]: Champ...
. This highlights the uniqueness of the moment! However, in the future, I would like to change, Right now, we have assigned a new rank “Tourist” to the 4+ rating. This highlights theuniqueness

Full text and comments »

  • Vote: I like it
  • +4557
  • Vote: I do not like it

3.
By ATSTNG, history, 7 years ago, In English
[Tutorial] Matroid intersection in simple words **[This article is also available in [Russian](https://codeforces.me/blog/entry/69287?locale=ru)]** Hello, CodeForces. I think that matroids are beautiful and powerful concept, however, not really well known in competitive programming. I’ve discovered matroids at 2019 Petrozavodsk Winter Training Camp. There was a problem that clearly cannot be solved using usual techniques I knew, editorial for this problem was just these three words “just matroid intersection”. Back then it took me more than 2 days of upsolving to find all the information and details I need and implement solution that gets Accepted on this. And it took way longer to actually understand why does it work and exactly how does it work. (I still hesitate in some details.) Of course, it is not hard to google up all the definitions and some related articles, but in my opinion they all are focused more on mathematical part of theory, strict proofs in some not really obvious but short ways, and observing only ke...
shortcuts guarantees us uniqueness of perfect matchings along the path. Until there is a shortcut for, Firstly, selecting a path without shortcuts guarantees us uniqueness of perfect matchings along, There will be unique matching in this cycle, as a consequence of uniqueness of matching in selected

Full text and comments »

  • Vote: I like it
  • +904
  • Vote: I do not like it

4.
By chromate00, 22 months ago, In English
Codeforces Round 1000 (Div. 2) — Anti-LLM Evaluation Report As the main problemsetter of [contest:2063], I know that a lot of you were somewhat disappointed to see that it was not a Div.1 contest. Though I am not the one who caused a lack of Div.1 contests, I understand your feeling. So I present to you the great surprise: The **Anti-LLM Evaluation Report** for [contest:2063], the first of its kind on a Div.2! In this blog we discuss about how the round combats against LLMs (especially focusing on OpenAI o1, the greatest of its kind while we prepared and tested the problemset), by looking at the timeline of how the problemset changed. --- So, let us begin with the initial problemset we had when the testing began. (The task names are anonymized, unless they are released to the public before or in the round) In the beginning, we had a problemset that looks like this: - **A' — B — C0 — D' — E' — F0** (If you are confused with the meanings, (letter)' means it was not used in the final problemset but exis...
- The second task to get swapped was F0. F0 was a version of **F** that only asks foruniqueness, . --- - The second task to get swapped was F0. F0 was a version of **F** that only asks foruniqueness

Full text and comments »

  • Vote: I like it
  • +587
  • Vote: I do not like it

5.
By purplesyringa, history, 2 years ago, In English
Please improve QoL for blogs I'm pretty sure I've spent more time writing blogs than contests on Codeforces. Over time, I've found plenty of rough edges. So this is a plea to the Codeforces team to fix them. I'm effectively going to say "please redo everything" over dozens of paragraphs, but I'll hopefully make the steps to the solution tangible and clear. If this is deemed way too ambitious, few improvements are better than none. [cut] <!-- --> ## Publication time So I write a post in the Codeforces UI, save a draft, update it a few times, think it's ready, and publish it. I open my brand new post and see: > ### Totally not a useless post > By [user:purplesyringa,2024-09-24], history, 3 days ago, In English Okay, wait, "3 days ago"? Oh, right, that's when I saved the first draft. Now people open the post, see "3 days ago", see 0 upvotes, and what do they think? That's right, they think it's garbage because no one's voted positive, so they skip the article. Maybe not everyone's like tha...
them right. This uniqueness also makes it hard to remember the right syntax. Finally, not everyone, Nothing but Codeforces can render them right. This uniqueness also makes it hard to remember the

Full text and comments »

  • Vote: I like it
  • +370
  • Vote: I do not like it

6.
By Bashca, 6 years ago, In English
Fenwick Tree generalization using Centroids Hello, Codeforces community! (Again) After asking many times, I realized that the central idea of this blog was not being understood, and I’ve finally decided to rewrite it. This time I want to be clearer and provide more details. This is not about the classic centroid decomposition, but I’ll try to keep it self-contained so the concept is understandable within this blog. --- ## What is a Centroid? In a tree, a centroid is a node that, when removed along with its incident edges, minimizes the size of the largest remaining connected component, see figure 1. <center> <img src="/predownloaded/03/3f/033f954d1d44920150b706caa12c0045f41bced4.png" alt="centroid of a tree and remaining components"> <br> <I>figure 1. Centroid of a tree and remaining components</i> </center> **Claim**: Let $W(v)$ be the size of the largest component after removing node $v$, and $n$ be the total number of nodes. If $v$ is a centroid, then: $$W(v) \le \frac{n}{2}$$ **Proof**: Supp...
## Uniqueness theorem:

Full text and comments »

  • Vote: I like it
  • +188
  • Vote: I do not like it

7.
By adamant, history, 4 years ago, In English
Big integers with negative digits: The Trygub numbers Hi everyone! Today we will talk about something that might be useful in programming competitions. Yay! Also great thanks to [user:antontrygubO_o,2023-04-30] for sharing this with me and others in a Discord server. Let's implement a data structure that maintains a big number $N$ in base $b$ and supports the following: - Given (possibly negative) integers $|x|, |y| \leq n$, add $x b^y$ to $N$. - Given $k$ and assuming $N \geq 0$, print the $k$-th digit of $N$. - Check if $N$ is positive, negative or equals to $0$. Each operation should take at most $O(\log n)$ amortized time and $O(q)$ memory. While some approach you may think of immediately would imply using segment tree, or a similar structure, the solution proposed here only requires `std::map`, so it's much shorter and easier to implement (at the slight expense of increased constant factor). It may be used in the following problems: - [#2302. 「NOI2017」整数](https://loj.ac/p/2302) - [problem:1817E] - [problem:1810F] ...
up the uniqueness of the representation, but we gain a whole lot of stability in exchange. The C, uniqueness of the representation, but we gain a whole lot of stability in exchange.

Full text and comments »

  • Vote: I like it
  • +263
  • Vote: I do not like it

8.
By minstdfx, history, 5 weeks ago, In English
[Shitpost] How to Teach Kids Basic Data Structures Using the Methods of a Mathematics Textbook ## Conventions This article is based on ordinary set theory. Natural numbers, integers, finite sequences, maps, Cartesian products, total orders, trees, induction, and the finite recursion theorem are assumed to be established. Write $\mathbf N=\{0,1,\ldots\}$ and $\mathbf N_{>0}=\mathbf N\setminus\{0\}$. All trees are finite trees; all intervals not otherwise qualified are integer intervals. For $l,r\in\mathbf Z$, put $$ [l,r]=\{i\in\mathbf Z:l\le i\le r\},\qquad [n]=[1,n]. $$ When $l>r$, $[l,r]=\varnothing$. For a nonempty finite set $E$, $|E|$ denotes its cardinality. The symbol $\sqcup$ denotes disjoint union. Composition of maps follows the convention $(f\circ g)(x)=f(g(x))$. For $n\ge1$, put $$ \lambda(n)=1+\lfloor\log_2 n\rfloor. $$ All asymptotic estimates are taken as $n\to\infty$; bounds written in terms of $\lambda(n)$ also apply to $n=1$. **Computational conventions.** Unless otherwise stated, we use the random-access machine model with word leng...
(5.7) and the two initial values. Uniqueness follows from the finite recursion theorem. $\square$, unique canonical interval: existence comes from moving up the ancestor chain, anduniqueness from the, uniqueness from the pairwise disjointness of canonical intervals. Hence $\mathscr P$ further

Full text and comments »

  • Vote: I like it
  • +210
  • Vote: I do not like it

9.
By Enigma27, 7 years ago, In English
Manthan, Codefest'19 Editorial ### [1208A &mdash; XORinacci](https://codeforces.me/contest/1208/problem/A) The sequence is $a$, $b$, $a\oplus b$, $a$, $b$, $a\oplus b$ $\cdots$ Since, the sequence has a period of $3$, $f[i] = f[i \mod 3]$. <br> <spoiler summary="Code"> ``` #include<bits/stdc++.h> using namespace std; int main() { int test,a,b,n; cin>>test; while(test--){ cin>>a>>b>>n; switch (n%3){ case 0: cout<<a<<endl; break; case 1: cout<<b<<endl; break; default: cout<<(a^b)<<endl; } } return 0; } ``` </spoiler> ### [1208B &mdash; Uniqueness](https://codeforces.me/contest/1208/problem/B) After removing a sub-segment, a prefix and a suffix remain, possibly of length $0$. Let us fix the prefix which does not contain any duplicate elements and find the maximum suffix we can get without repeating the elements. We can use map/set ...
### [1208B — Uniqueness](https://codeforces.me/contest/1208/problem/B), ; Uniqueness](https://codeforces.me/contest/1208/problem/B) After removing a sub-segment, a prefix and

Full text and comments »

  • Vote: I like it
  • +133
  • Vote: I do not like it

10.
By Zachary_Gao, history, 3 months ago, In English
Linear Basis over Composite Moduli: Timestamped $p$-adic Echelon Table > This article presents an algorithmic research result developed by GPT-6-ASTRA. > The complete code, formal proofs, benchmarks, and experimental results are available in the repository: [ASTRA4OI](https://github.com/Zi-Gao/ASTRA4OI). ## Conclusions The algorithm achieves a time complexity close to that of standard interval linear bases over fields. Let: $$m=\prod_{s=1}^{w}p_s^{k_s},\qquad K=\sum_s k_s.$$ | Mode | Dominant Modular Ops (Preprocessing) | Dominant Modular Ops (Per Query) | Basis Structure Space | | --- | --- | --- | --- | | Prime power, offline by right endpoint | $O(nd^2k)$ | $O(d^2)$ | $O(d^2k)$ | | General composite modulus, offline by right endpoint | $O(nd^2K)$ | $O(wd^2)$ | $O(d^2K)$ | | Persistent prefixes, online queries on arbitrary historical intervals | Same as above | Same as above | $O(nd^2K)$ | In particular, when `m = p²`, each column requires only two slots, achieving the same dominant asymptotic complexity as a standard linear basis ov...
### Lemma 1: Uniqueness of Digit Combinations, Conversely, if a required slot is empty at any step, the uniqueness of the $p$-digit basis

Full text and comments »

  • Vote: I like it
  • +25
  • Vote: I do not like it

11.
By wuhudsm, history, 16 months ago, In English
TheForces Round #43 (DIV2-Forces) Editorial Reminder: We welcome you to participate in the official DIV1/DIV2 round scheduled on the 31st! [A](https://codeforces.me/gym/106014/problem/A) Idea:[user:tamzid1,2025-07-25] <spoiler summary="solution"> We can see if $x$ is a perfect square, $x^x$, $x^{(x^x)}$, $\ldots$ are also perfect square. Proof: assume $x=y^2$, $x^z=(y^z) \cdot (y^z)$. So the answer is the number of perfect squares not greater than $n$. There are exactly $\lfloor \sqrt{n} \rfloor$ integers $x$ (with $1 \leq x \leq n$) such that $x$ is a mystic number. </spoiler> <spoiler summary="code(C++)"> ```cpp #include <iostream> #include <cmath> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; cout << static_cast<int>(sqrt(n)) << '\n'; } return 0; } ``` </spoiler> <spoiler summary="Rate the Problem"> Amazing problem: Goo...
distinct elements. - Total uniqueness value: `n`. (This is also the `minimum m` we can achieve), length > 1** has all distinct elements. - Total uniqueness value: `n`. (This is also the `minimum, )**: The maximum uniqueness we can achieve is `3n - 3`, and any value can be achieved in between. (This is, - We already get $n$ uniqueness from 1-element subarrays. - We now need ${m - n}$ more distinct

Full text and comments »

  • Vote: I like it
  • +28
  • Vote: I do not like it

12.
By SteamTurbine, 14 years ago, In English
Codeforces Round #180 Editorial [problem:298A] The starting position can be anywhere with a footprint. The footprints can be categorized into 3 types. 1. only $L$ s 2. only $R$ s 3. $R$ s followed by $L$ s In case 1, we end in the left of all footprints. In case 2, we end in the right of all footprints. In case 3, we either end in the rightmost $R$ or the leftmost $L$ [problem:298B] We can simply move by greedy method &mdash; only moves when it takes the boat closer to the destination. [problem:297A] **Obv 1**: If $a$ has odd parity, we can apply operation 1 to increase its number of 1s by $1$. **Obv 2**: If $a$ has even parity, its number of 1s cannot increase anymore. **Claim**: If the number of 1s in $a$ is not fewer than those in $b$, we can always turn $a$ to $b$ The idea is to make a copy of $b$ at the right of $a$. Lets assume $a$ starts with even parity. If we need a $0$, simply apply operation 1. If we need a $1$, keep remove from the head until we removed an 1. Notice t...
first part, we give uniqueness to $a$. In the second part, we give uniqueness to $b$. In the third, not care about the array that we are not giving uniqueness to., $ different elements. The idea is to split $s$ into three parts: In the first part, we giveuniqueness

Full text and comments »

  • Vote: I like it
  • +35
  • Vote: I do not like it

13.
By PokemonMaster, history, 11 months ago, translation, In English
Trolling on IZhO (math) At the recent IZhO in mathematics there were unusual problems, many of which trolled the majority of participants. P2 was solved by a trick, and many failed to find it. I also did not solve it: during the contest I acted too technically, which did not help. My approach was an attempt to squeeze the desired number between given ones, which is a stronger statement (but, as it turned out, equivalent) that I managed to prove after the contest. --- **Problem.** Let $n$ be a positive integer for which there exist positive integers $a$ and $b$ such that $$ \lfloor a\sqrt{10} \rfloor = n = \lfloor b\sqrt{11} \rfloor. $$ Prove that there exists a positive integer $c$ such that $$ n = \left\lfloor c(11\sqrt{10} - 10\sqrt{11}) \right\rfloor. $$ --- **Official solution** Denote $$ \alpha = \sqrt{10}, \quad \beta = \sqrt{11}, \quad \gamma = 11\sqrt{10} - 10\sqrt{11}. $$ $$ \gamma = \frac{\sqrt{110}}{\sqrt{10} + \sqrt{11}} = \frac{1}{\alpha} + \frac{1}{\be...
= \max(a + a\sqrt{10/11}; b + b\sqrt{11/10}). $$ --- **Step 2. Uniqueness of the integer, **Step 2. Uniqueness of the integer solution**

Full text and comments »

  • Vote: I like it
  • +19
  • Vote: I do not like it

14.
By FairyWinx, 19 months ago, translation, In English
[Tutorial] Online Data Structure for Counting Pairs at Distance at least k Exactly Once Recently, the following problem was presented at the school BSUIR OPEN XIII: Given an array of integers and point update queries. After each such query, you need to respond online: how many pairs $i, j$ exist that yield the maximum possible sum and are at a distance of no more than $k$. Without online processing &mdash; this is almost a classic problem from the Canadian Olympiad for school students (solvable using DCP-offline), but we will learn to do it online. Essentially, I want to learn how to create a data structure that can account for each such pair exactly once. Personally, I can do it in $O(\log n)$ per query. Let's complete the segment tree to a power of two (otherwise it won't work). Then we will have some number of levels, and at each level, we will have the same number of nodes. For convenience, let $l_v, r_v$ denote the segment that the subtree is responsible for, and let $lvl_{i, j}$ denote the node at level $i$ with number $j$ (the nodes at the same level are o...
these will be all relevant pairs. The uniqueness is obvious, so I will leave it for the reader to, . The uniqueness is obvious, so I will leave it for the reader to prove.

Full text and comments »

  • Vote: I like it
  • +153
  • Vote: I do not like it

15.
By UnexpectedValue, 21 month(s) ago, In English
[Tutorial] A New Perspective on Numbers and Operators: Introducing Group Theory We often start our mathematical journey with counting, primes, and basic arithmetic. Then we encounter modular arithmetic, with its intriguing properties and theorems like Euclid's algorithm and the Chinese Remainder Theorem. But what if there's a deeper, more abstract framework that ties all these concepts together? You might have encountered hints that group theory is behind some clever algorithms and data structures ([like this comment suggests](https://codeforces.me/blog/entry/103174?#comment-915676)). But if you've tried to learn about it, you might have found resources that felt either too abstract and disconnected from your existing knowledge ([for instance](https://zhtluo.com/cp/from-burnside-to-polya-a-short-introduction-to-group-theory.html)), or too intimidating and complex ([like this one](https://codeforces.me/blog/entry/91731)). This blog aims to bridge that gap. We'll start with familiar ground in discrete math and modular arithmetic, and then progressively in...
Claim 1: For given $\oplus$ operator and 3 equivalence, $ , given $a,b$ are co-prime with $n$ Claim 1

Full text and comments »

  • Vote: I like it
  • +93
  • Vote: I do not like it

16.
By Lyde, history, 4 years ago, In English
(Kind of) A brief overview about the near future of Competitive Programming Think about this. In the near future, let's say 10-15 years, technology will improve drastically, and artificial intelligence (AI) will probably be a very important thing in daily life and work. What would be its effect on Competitive Programming? This topic is not new, Every 1-2 years there's someone talking about it on numerous platforms. And probably all received the same answer: It's dubious, only time will tell us, which is true. But in some way, we can just imagine and make probable guesses about what may happen to CP in the future. This blog will mostly summarize my guesses and questions about the near future of CP, and we can discuss it somewhat to hope for an even better community in the future. #### **I. Competitive Programming Problems** One thing we can agree with is in the near future, with a huge potential in the CP community and the existence of AI, the quality of the problems may be better. The knowledge standard will increase over time, to match the improvement o...
been discussed before, and a lot of people have said it's not possible due to theuniqueness of, things will probably reduce the uniqueness and excitement that CP brings over the years, which means, will probably reduce the uniqueness and excitement that CP brings over the years, which means this will

Full text and comments »

  • Vote: I like it
  • +107
  • Vote: I do not like it

17.
By eulmelk, 6 months ago, In English
Code League — National Competitive Programming Contest — Round 2 — Editorial Here is the link to the contest: [Link](https://codeforces.me/contestInvitation/f528fcc29732183e36f82a0adfdc6dbac0743f3f) ### [A. Free Coupon](https://codeforces.me/gym/690685/problem/A) <spoiler summary="Rate the Problem"> - **How good is this problem?** - Very Good - Good - Bad - Very Bad - **How hard is this problem?** - Very Easy - Easy - Hard - Very Hard </spoiler> <spoiler summary="Hint"> Which items should be taken using coupons? <spoiler summary="Answer"> Since a coupon can be used on any item regardless of its price, it is always best to use coupons on the most expensive items. This allows us to spend our coins only on cheaper items. </spoiler> </spoiler> <spoiler summary="Solution"> The problem asks us to find the maximum number of items Abenezer can obtain given $k$ coins, with the offer that every $b$ items bought with coins yiel...
component does not contain an anchor, and uniqueness is impossible. , condition for uniqueness is that every connected component must contain at least one anchor. Now we, necessary and sufficient condition for uniqueness is that every connected component must contain at

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

18.
By ok12, 9 months ago, In English
Editorial of ICPC de Tryst 2026 I hope you enjoyed the contest! [Contest link](https://codeforces.me/contestInvitation/f8ab858a73f3627f85787c828e7ba84d12495ce9) <spoiler summary="Rating Predictions and Tags for the Problem"> | Problem | Expected Rating | Tags| | :---: | :---: | :---: | | [A. Game is Game](https://codeforces.me/gym/675631/problem/A) | 1500 | games, math | | [B. Hakurei Shrine's Purification Ritual](https://codeforces.me/gym/675631/problem/B)| 1600 |number theory, binary search| | [C. Permutation Game](https://codeforces.me/gym/675631/problem/C) | 2600 | dp, greedy, implementation,brute force | | [D. Path Blow-up?](https://codeforces.me/gym/675631/problem/D) | 2400|bitmasks, trees, dp, combinatorics, implementation| | [E. Coffee Date of MEX](https://codeforces.me/gym/675631/problem/E)|2100|constructive algorithms, brute force| | [F. Wordleforces](https://codeforces.me/gym/675631/problem/F) |1800 |math, combinatorics| | [G. Adaptive Guessing](https://codeforces.me/gym/675631/probl...
of permutations: **1. Forced Expansion (Uniqueness of Validity):** Suppose the current segment, **1. Forced Expansion (Uniqueness of Validity):** Suppose the current segment $[L, R]$ is stable

Full text and comments »

  • Vote: I like it
  • +102
  • Vote: I do not like it

19.
By Calypsoo, history, 20 months ago, In English
Srijan 2025 | Pass The Baton | Editorial #### [600816A &mdash; Pass The Baton](https://codeforces.me/gym/600816/problem/A) <spoiler summary="Solution"> Suppose the total number of lines of code is a multiple of 3, i.e., of the form $3n$. Then the work can be evenly distributed among the three members — each writing exactly $n$ lines of code <br> If the number of lines is of the form $3n + 1$, then the optimal distribution would be: ${n,\ n,\ n + 1}$ <br> If the number of lines is of the form $3n + 2$, then the optimal distribution would be: ${n,\ n + 1,\ n + 1}$ <br> In both uneven cases above, the maximum number of lines any one member has to write is still ${n + 1}$. Thus, for all three forms ${3n,\ 3n + 1,\ 3n + 2}$, the answer is always: $\lceil \frac{x}{3} \rceil$ where $\lceil . \rceil$ is the ceiling value, and $x$ is the total number of lines of code. </spoiler> <spoiler summary="Code"> ```c++ #include <bits/stdc++.h> using namespace std ; void solve() { int x; cin >> x; cout << (x + 3 - 1)...
Let's break the possible values of `m` (the uniqueness value) into, distinct elements. - Total uniqueness value: `n`., maximum uniqueness we can achieve is `3n - 3`., #### [600816D — Uniqueness in Three](https://codeforces.me/gym/600816/problem/D), - We already get $n$ uniqueness from 1-element subarrays. - We now need ${m - n}$ more distinct, > #### [600816D — Uniqueness in Three](https://codeforces.me/gym/600816/problem/D

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

20.
By suvro_coder, history, 7 years ago, In English
Point Updates in Merge Sort Trees Hello, I have implemented the version of **merge sort tree** that can handle **point updates** and supports duplicate elements in the tree. I have done it using [C++ STL: Policy based data structures](https://codeforces.me/blog/entry/11080). There is no implemented tree multiset in STL. So, I have used pair<T,int> as a key where the second element in pair is the time when item has been added, in order to maintain uniqueness of elements. The time complexity summaries are as follows : - **Build Complexity** &mdash; _O(n log^2 n)_ - **Query Complexity** &mdash; _O(log^3 n)_ - **Update Complexity** &mdash; _O(log^2 n)_ The code **queries the kth largest element in a range**, similar to [MKTHNUM](https://www.spoj.com/problems/MKTHNUM/) in spoj but with an **update** part. ~~~~~ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long int #define lc ((n)<<1) #define ...
added, in order to maintain uniqueness of elements. The time complexity summaries are as follows, element in pair is the time when item has been added, in order to maintain uniqueness of elements.

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

21.
By Heartbell, history, 8 years ago, In English
Why counting with multiset is a bad idea? Because $\text{\footnotesize \texttt{multiset::count}}$ works in $O(n)$ time. Quite recently I needed to solve this kind of problem: $\text{{\bfseries Abridged statement.} Given an array } A,\ |A| = n,\ \forall i \in [1..n]\ a_i \in [-10^9..10^9] \text{ and } a_i \in \mathbb{Z} \text{ compute the value of the most frequent element in } A.$ I decided to use $\text{\footnotesize \texttt{multiset}}$, since it had some __useful__ method called $\text{\footnotesize \texttt{count}}$. And since I needed to _count_ the elements I coded something like this: ~~~ int main() { int n; vector<int> a(n); multiset<int> cnt; /* Read array */ // Insert elements in multiset for (auto i : a) cnt.insert(i); // Choose among all elements of a the most frequent int ans = 0; for (auto &i : cnt) ans = max(ans, cnt.count(i)); cout << ans << endl; return 0; } ~~~ Now. The problem was that this code was jud...
{\footnotesize \texttt{.\_M\_insert\_equal}}$ that doesn't care about uniqueness : it will just put there another, {\footnotesize \texttt{multiset}}$ does not depend on the uniqueness of the nodes. Look at these two excerpts, {multiset}}$ is that $\text{\footnotesize \texttt{multiset}}$ does not depend on theuniqueness of the

Full text and comments »

  • Vote: I like it
  • +44
  • Vote: I do not like it

22.
By Immanence, 12 months ago, In English
Distinct GCDs (Hard) - Proof that the construction is optimal Why the construction is optimal ================== Welcome to my first blogpost :) This problem https://codeforces.me/contest/2158/problem/F2 was one of the hardest problems I've tried to understand. The official editorial gives a very nice construction but, coming from an analysis/pure math background, for the sake of intuition I sought a proof of (a) a lower bound on the number of distinct values we may use, and (b) why the $10 \times 10$ construction is in fact optimal for all $n \le 5000$. As such, this post is the same solution as the editorial written in a more "theorem" style. To summarize, I derive the extremal function $g(k)$ = maximum number of distinct adjacent gcds you can get if you use only $k$ distinct values, show that the construction exactly matches that bound, then prove the gcd-uniqueness of the $10 \times 10$ grid in a bit more detail. First glance ============================================== At first sight, the problem feels impossible for thre...
prove the gcd-uniqueness of the $10 \times 10$ grid in a bit more detail., , then prove the gcd-uniqueness of the $10 \times 10$ grid in a bit more detail. First glance

Full text and comments »

  • Vote: I like it
  • +18
  • Vote: I do not like it

23.
By Yedige2, history, 14 months ago, In English
Do you know about eugalt, the king of shortest codes? I think many of you know strong contestants on CF by rating, but today I want to talk about a different kind of legend here. His name is [user:eugalt,2025-09-24]. This guy has been around for more than 8 years, always solving problems. But his uniqueness is not about rating, not about speed. His superpower is: He always writes the smallest code solution. Every time I check submissions by code size, I see his name at the top. And honestly, nobody can beat him there. His Python tricks are crazy — he can compress a full solution into a few lines (sometimes even one line). And the funny part is: he never writes blogs, never tries to show off. Just quietly submitting his golfed codes, again and again. If you don’t pay attention, you might never notice, but if you check carefully wow, it’s really impressive. I think this deserves respect. Codeforces is not only about rating, but also about creativity and style. And eugalt shows that coding can also be art. So, next time you sol...
than 8 years, always solving problems. But his uniqueness is not about rating, not about speed. His, This guy has been around for more than 8 years, always solving problems. But his uniqueness is not

Full text and comments »

  • Vote: I like it
  • +108
  • Vote: I do not like it

24.
By UTPC_Admin, 2 years ago, In English
UTPC Fall 2024 Contest #1 Editorial Hope you enjoyed our contest! The editorial is below: [A &mdash; Spookeepy](https://codeforces.me/gym/105346/problem/A) Author: [user:porkchops,2024-09-19] <spoiler summary="Solution"> We can use distance formula to calculate the distance from each point in the map to your current location. We return the point with minimum distance. If there are multiple points at the same minimum distance, keep the point with the smallest x-coordinate, and if there is still a tie, keep the point with the smallest y-coordinate (as stated in the problem description). </spoiler> [B &mdash; Ternary Nightmare](https://codeforces.me/gym/105346/problem/B) Author: [user:B-1168,2024-09-19] <spoiler summary="Solution"> The specific mixtures of 0, 1, and 2s are not as significant as the length of contiguous blocks of 0s and 1s (those "contiguous blocks" can have length 0, when between consecutive instances of 2). For example, we can parse the $1201012200120012$ sample into 0-1 blocks of le...
"uniqueness" condition is satisfied. Thus a simple solution is to simply choose the $d \cdot x

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

25.
By A.R.A, history, 4 years ago, In English
Complaint about problem B. Candies in CodeTON Round 4 (Div. 1 + Div. 2, Rated, Prizes!) ! Hi Codeforces ! Hi [user:MikeMirzayanov,2023-04-01] As an avid participant of Codeforces contests, **I have noticed a duplicated problem** [problem:1810B] in [contest:1810] from problem [D. Mana](https://constructor2023.contest.codeforces.com/group/sVRDLercWX/contest/431163/problem/D) in **Constructor Open Cup 2023** which was held yesterday ! For whom didn't register on Constructor Open Cup 2023 : that is the problem screenshot: ![ ](/predownloaded/d8/32/d83247ed54fa8c9d57e62c3942100e79485f8bf6.png) **possible Ways of cheating** : - Submitting solution on Constructor Open Cup 2023 to be judged avoiding any extra penalty with wrong answers. - Copying a pre-accepted old solution and adding just one line of code (that line of code is the only difference between the 2 problems!). - Using [Constructor Open Cup 2023 — Editorial](https://drive.google.com/file/d/1PTheugypUVSYegJ4hiuG5WUqWL8ixU5o/view). - Many other unfair ways. It's frustrating to see the same problem idea...
or constraints. This not only takes away from the uniqueness and creativity of the contest, but also, uniqueness and creativity of the contest, but also gives an unfair advantage to those who have already

Full text and comments »

  • Vote: I like it
  • -38
  • Vote: I do not like it

26.
By istiak_ahmed, history, 2 years ago, In English
The NP-Hard problem of name selection When it comes to selecting the baby name, many parents find themselves overwhelmed by the sheer number of choices available. Each name carries its own unique meaning, cultural significance, and personal appeal. But what if we told you that choosing the ideal baby name could be modeled as a complex NP-hard problem? The Problem Statement: ---------------------- **Optimal Baby Name Selection**: Imagine you are tasked with selecting the perfect name for a baby. However, this isn't just any ordinary selection process. You have a list of thousands of potential names, each with its own meaning, cultural significance, and compatibility with the parents' preferences. The challenge is to find a name that optimizes all these factors, ensuring that the chosen name has the highest possible "satisfaction score" based on various criteria. Criteria for Name Selection: ---------------------------- Meaning Alignment: The meaning of the name should resonate with the values and beliefs of ...
be too popular, reducing its uniqueness., uniqueness. To make matters more complex, consider that each criterion has its own weight based on the

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

27.
By prac64, history, 8 years ago, In English
Sum of minimum number of fibonacci numbers that add to N, Greedy Works, proof needed on optimality !! Hello Codeforces, Recently I came across a problem where we have to output the minimum number of fibonacci terms needed to make up a number. Repeating the terms to make up the representation is allowed. The fibonacci sequence 1,2,3,5,8,13,21.. will be used for all cases. I can explain better with an example, lets say N=6, then the answer is 2, you can use the numbers 1 and 5 to make 6, another combination is 3 3, which also gives the optimal answer 2. However in this question we only need the minimum number of terms, not what those terms are. Other examples: input = 5 output = 1 input = 7 output = 2 input = 19 output = 3 I tried out some examples and even submitted the greedy algorithm on this problem, which is to keep subtracting the largest fibonacci number possible which still keeps the result non-negative, and adding 1 for each of those terms subtracted. A few blogs on the same topic give this algorithm for solving the problem, however no proof on cor...
correctness. A quick wikipedia search yielded Zuckendorf theorem, which just provesuniqueness, A quick wikipedia search yielded Zuckendorf theorem, which just proves uniqueness with non-adjacent

Full text and comments »

  • Vote: I like it
  • +31
  • Vote: I do not like it

28.
By dkdk, history, 4 months ago, In English
Constructive Algorithms: Binary & Fibonacci # Fixed Value Construction: Binary & Fibonacci *Translated to English using AI. For a better reading experience, please visit: [https://dk-qwq.github.io/blog/posts/bin-fib-decomposition/](https://dk-qwq.github.io/blog/posts/bin-fib-decomposition/)* ## Core Idea: Base Graph + Regulator Regardless of the fixed-value construction method used, the essence is to construct a logarithmic-level base, and then use a regulator to construct the target fixed value through splitting methods similar to binary or Fibonacci. --- ## 1. Binary Decomposition ### 1. Principle Overview By observing the value function, construct a base graph of the form $f_i = 2 \times f_{i - 1}$, obtaining $f_i = 2^i$. Perform a binary decomposition on the required fixed value, and finally achieve the construction of the fixed value through the regulator. ### 2. Practice Problems #### [Codeforces 388B &mdash; Fox and Minimal path](https://codeforces.me/problemset/problem/388/B) **Problem Stat...
**2. Proof of Uniqueness** * **Lemma**: The sum of a subset of non-consecutive Fibonacci numbers, Uniqueness** * **Lemma**: The sum of a subset of non-consecutive Fibonacci numbers no greater than $F_n

Full text and comments »

  • Vote: I like it
  • +16
  • Vote: I do not like it

29.
By nuredinbederu10k, history, 16 months ago, In English
A2SV Contest #26 Editorial [Here](https://codeforces.me/contestInvitation/aa6037d6b47fcf6618fbb56b120dca0f7bc735b8) is the link to the contest. All problems are from Codeforces' problem set [A.Maxim vs. Yogurt: The Great Discount Battle](https://codeforces.me/gym/629689/problem/A) <spoiler summary="Solution"> We want the **minimum cost** to buy exactly $n$ yogurts when: - A single yogurt costs $a$ burles. - A promotion lets you buy **two yogurts for $b$** burles. You may mix buying single yogurts and buying pairs. Let's reason through the options, compare costs, and derive a compact formula. --- #### **_Key Observations_** 1. **Always-available baseline:** - You can always buy all yogurts one-by-one. That gives the cost. - `Cost = n.a` 2. **When is the promotion useful?** - Buying two yogurts with the promotion costs $b$. Compare this to buying those two separately:$2a$. - If $b \geq 2a$, the promotion **is not beneficial** (or is equal). Then buying every ...
= robots. - Edge `u -> v` means `u` beat `v`. 2. **Uniqueness Condition:** - The ordering, . **Uniqueness Condition:** - The ordering is **uniquely defined** if and only if the **DAG

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

30.
By back_slash, history, 8 years ago, In English
Question on Prime Factorization You are given two natural numbers N and K. You need to represent the number N as a product of K numbers such that all the K numbers are >= 2 and the sum of the K numbers is minimum. The constraints on the value of N <= 10^12. Given such values of K for which the answer always exist. My Solution:- After finding the prime factorization of the number N. Insert the factors in a multiset and then solve the problem greedily. Take the first 2 elements of the multiset, remove them and then insert their product in the multiset. Keep on repeating this process until the size of multiset becomes equal to K. I don't know whether the above approach is correct or not and also I am not sure whether the answer will be unique or not. Any suggestions for the given approach or some new approach are welcomed. UPD:- I know my approach is incorrect but still I am unable to figure out anything about uniqueness. Whether the answer will be unique or not.
about uniqueness. Whether the answer will be unique or not. , UPD:- I know my approach is incorrect but still I am unable to figure out anything aboutuniqueness

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

31.
By M0jo, history, 6 years ago, In English
How to check the graph for the uniqueness property of the path? Hi, everyone Some **directed** graph is given. Check the graph for the uniqueness property of the path(for any two vertices **v u**, there is no more than _one_ simple path with the beginning in **u** and the end in **v**). Simple path is a non-empty path whose vertices are all pairwise distinct. Does anyone know a solution to this problem faster than running BFS from each vertex?
How to check the graph for the uniqueness property of the path?, Hi, everyone Some **directed** graph is given. Check the graph for the uniqueness property of, Some **directed** graph is given. Check the graph for the uniqueness property of the path(for any

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

32.
By Alilo-Sy, history, 8 years ago, In English
Can you code Nonogram solver?? Hello. I need some help in coding a simple c++ program that solves a [Nonogram](https://en.wikipedia.org/wiki/Nonogram) puzzle. The program reads a text file which is the description of the puzzle, it looks like this: m n (m, n <= 50) Then m lines that describes the rows. Then n lines that describes the columns. And the program should find one image (any image is accepted in case of many) that fits all the descriptions (no need to check the uniqueness of the solution). The only header files to use are basically (iostream, fstream, cstdlib and string). Any help would be appreciated.
) that fits all the descriptions (no need to check the uniqueness of the solution). The only header

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

33.
By cf_is_best, history, 7 years ago, In English
Provide worthy problems Cf is really the best pastime during this quarantine. Having increased the contest frequency by almost double in this quaratine. But I am quite dissapointed after today's round.Though the problems were good, but you might have read many comments regarding solution that was available on GeeksforGeeks/Stack overflow. I just want to tell, admins and all the respected authours, that you can decrease the contest frequency, but please don't compromise with the level/uniqueness of problems on cf. Cf is the best and will always be.
the contest frequency, but please don't compromise with the level/uniqueness of problems on cf. Cf

Full text and comments »

  • Vote: I like it
  • -30
  • Vote: I do not like it