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.
By 1-gon, history, 5 weeks ago, In English
[Tutorial] Blossom Algorithm for General Matching in O(n^3) I have decided to write a tutorial on a topic not even [user:Um_nik,2021-06-29] knows! ([source](https://codeforces.com/blog/entry/92248)) In this tutorial, I will talk about the blossom algorithm, which solves the problem of **general matching**. In this problem, you are given an undirected graph and you need to select a subset of edges (called matched edges) so that no two edges share a vertex, and the number of matched edges is maximized. More common in competitive programming is bipartite matching, which is the same problem but when the graph is guaranteed to be bipartite. In competitive programming, general matching seems to get a lot of hate for being very challenging to implement. However, the blossom algorithm is quite beautiful, and important in the history of algorithm research. It will help if you are already familiar with bipartite matching. I will discuss the high level ideas of the algorithm, but my main focus will be on the tricky implementation details. So you may...
~~~~~ vector trace(int x) { vector vx; while(true, ### Trace Path to Root, ) { vector vx = trace(x); vector vy = trace(y, , we should trace the paths from $x$ and $y$ to the root to determine if this event is a blossom

Read more »

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

 
 
 
 
2.
By SPyofgame, history, 5 months ago, In English
Knapsack the tutorial -------------------- -------------------- <a name="TOC"></a> > **Teleporter:** **[**[Previous](#status)**]** | | | **[**[Next](#statement)**]** ### <strong> <center style="color:red;"> Table of content </center> </strong> > This blog isnt the best but worth spending time to read it | Teleporter | Description | | :--------------------------------------------------------------- | :-------------------------------------------------------------------------------------------- | | [I. STATEMENT](#statement) | Taking about the problem | | [II. EXAMPLE](#example) | To understand the problem better | | [III. Solution for small number ...

Read more »

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

 
 
 
 
3.
By Baba, history, 5 years ago, In English
CodeCraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) Editorial [757A &mdash; Gotta Catch Em' All!](http://www.codeforces.com/contest/757/problem/A) ------------------ **Author:** [user:tanujkhattar,2017-01-13] **Testers:** [user:r.arora,2017-01-13] [user:born2rule,2017-01-13] **Expected complexity**: $\mathcal{O}(n)$ **Main idea**: Maintain counts of required characters. Since we are allowed to permute the string in any order to find the maximum occurences of the string "Bulbasaur", we simply keep the count of the letters 'B', 'u', 'l', 'b', 'a', 's', 'r'. Now the string "Bulbasaur" contains 1 'B', 2'u', 1 'l', 2'a', 1 's', 1'r' and 1 'b', thus the answer to the problem is Min(count('B'), count('b'), count('s'), count('r'), count('l'), count('a')/2, count('u')/2). You can maintain the counts using an array. **Corner Cases:** 1. Neglecting 'B' and while calculating the answer considering count('b')/2. 2. Considering a letter more than once ( 'a' and 'u' ). <spoiler summ...
#define TRACE, #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template void __f

Read more »

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

 
 
 
 
4.
By Akikaze, 17 months ago, In English
Ozon Tech Challenge 2020 Editorial We apologize for the huge gap from F to G. In the meantime, you can join the Discord server of AC &mdash; a competitive programming forum &mdash; [here](https://discord.gg/YgaRNT). [problem:1305A] ------------------ Author: [user:Ari,2020-03-03] Development: [user:Ari,2020-03-03], [user:dorijanlendvaj,2020-03-03] Editorialist: [user:Ari,2020-03-03] <spoiler summary="Tutorial"> [tutorial:1305A] </spoiler> <spoiler summary="Solution (Ari, C++)"> Submission link: [submission:72363754] <spoiler summary="Source code in plain text"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; vector<int> a(n), b(n); for(int i = 0; i < n; i++) { cin >> a[i]; } for(int i = 0; i < n; i++) { cin >> b[i]; } if(a == vector<int>({1, 8, 5}) && b == vector<int>({8, 4, 5})) { cout << "1 8 5\...
() { fill(dsu, dsu + N, -1); } int trace(int u) { return dsu[u] < 0 ? u, int connect(int u, int v) { if ((u = trace(u)) == (v = trace(v))) { return 0, int trace(int u) { return dsu[u] < 0 ? u : dsu[u] = trace(dsu[u]); }

Read more »

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

 
 
 
 
5.
By lethan3, history, 2 months ago, In English
Hunt-Szymanski Algorithm Explained (LCS but optimized for special cases) Hello Codeforces, Just wanted to leave this explanation here in case anyone needs one for the Hunt-Szymanski algorithm; I wasn't able to find a good explanation online and mostly figured it out by reading through a github file [here](https://github.com/LetsTrie/Code-Library-Of-Others/blob/master/sgtlaugh/Hunt-Szymanski.cpp), where you can find the implementation. The Hunt-Szymanski Algorithm is an algorithm that finds the LCS in O((N + K) log N) time complexity, where N is the maximum length of a string and K is the number of matches between the two strings. This is especially useful when the number of occurrences of each letter is bounded, like if each letter is guaranteed to appear at most twice or thrice in each string. For example, if the two strings are "abbcd" and "cdea", the matches would be (0, 3), (3, 0), and (4, 1) where the indices are zero-based. Then K would be 3 since there are 3 pairs where the characters of each string are the same. Clearly, K = N^2 at worst. ...
with the strings "acbdd" and "cabad" (Tracing through with a diagram should be helpful.), " (Tracing through with a diagram should be helpful.) First we initialize rev: rev['a'] = {0

Read more »

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

 
 
 
 
6.
By kuruma, 9 years ago, In English
Analysis on Trace problem (Code 157B) The second problem that made its way here is “Trace”, both because it was an interesting problem on its own right and also because I really like Sherlock Holmes’ books. - **Understanding the problem statement** Apart from having an exciting background story, there is some information we need to take note of if we are to solve this problem correctly: _“ (…) the red and the blue color were alternating, i. e. followed one after the other. The outer area of the wall (the area that lied outside all circles) was painted blue. (…)”_ _“Let us remind you that two circles are called concentric if their centers coincide. Several circles are called concentric if any two of them are concentric.”_ Those two sentences above are the key in solving this problem. From the first one, we can immediately tell, that the circle with larger radius will be red, and the others will be: blue, red, blue, red, etc, accordingly to the pattern described above. The second sentence, describes to us...
Analysis on Trace problem (Code 157B), The second problem that made its way here is “Trace”, both because it was an interesting problem

Read more »

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

 
 
 
 
7.
By skywalkert, history, 2 years ago, In English
2017 CMUT BeihangU Contest, Editorial This editorial corresponds to [contest:102253] (stage 1), which was held on Jun 25th, 2017. There are 12 problems in total. You can solve them as a team member or an individual in a 5-hour contest. By the time you join as virtual participants, 770 teams, or even more, will compete with you virtually. --- Editorial in the English version has been completed, which is a bit different from its Chinese version (mostly because I don't want bad editorials to ruin the contest, lol). However, **for the sake of hiding spoilers**, editorials are locked and will be shown as the following conditions are met: - Editorials for the easiest 4 problems will be revealed after the replay **(all unlocked)**; - Each for the hardest 5 will be released if the corresponding problem has been solved by at least 5 users or teams on Codeforces::Gym **(all unlocked)**; - Each for the others will be published when the relevant problem has been solved by at least 10 users or teams in virtual participati...
be decomposed into one or more disjoint cycles, which are found by repeatedly tracing the application, , which are found by repeatedly tracing the application of the permutation on some elements.

Read more »

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

 
 
 
 
8.
By SPyofgame, history, 8 months ago, In English
C2/A2-Binary Table minimize operations ### Original Problem - Easy Version: [Div 2](https://codeforces.com/contest/1440/problem/C1), [Div 1](https://codeforces.com/contest/1439/problem/A1) - Hard Version: [Div 2](https://codeforces.com/contest/1440/problem/C2), [Div 1](https://codeforces.com/contest/1439/problem/A2) ------- You are given a binary table of size $n×m$. This table consists of symbols $0$ and $1$ You can make such operation: select $3$ different cells that belong to one $2×2$ square and change the symbols in these cells (change $0$ to $1$ and $1$ to $0$) Your task is to make all symbols in the table equal to $0$. You dont have to minimize the number of operations. **(It can be proved, that it is always possible)** -------- And the constraints are - $2 \leq N, M \leq 100$ - Easy Version: Limited in $3 \cdot N \cdot M$ operations - Hard Version: Limited in $1 \cdot N \cdot M$ operations <spoiler summary="Code solution without minimizing (with comments)"> <spoiler summary="Problem ...
'; if (show_trace == false) break; /// If you only want the mask and not the trace } while, ) { mask ^= 1 << (i * m + j); } int lim; vector F; vector trace; void bfs(int s, if (F[v] == -1) /// If not visited { trace[v] = u, int lim; vector F; vector trace; void bfs(int s) { trace.assign(lim, 0, trace[s] = -1; F[s] = 0;

Read more »

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

 
 
 
 
9.
By Karan2116, history, 5 years ago, In English
Everything About Dynamic Programming **I decided to gather some good material on the web related to DP and found some good explanation by svg on topcoder forums..Hence wrote this blog.Will format it when i get time.** ![ ](http://codeforces.com/predownloaded/2c/af/2caf058ab9cf6db0f875c573fb0d6e73de572122.png) **Problem:** About 25% of all SRM problems have the "Dynamic Programming" category tag. The DP problems are popular among problemsetters because each DP problem is original in some sense and you have to think hard to invent the solution for it. Since dynamic programming is so popular, it is perhaps the most important method to master in algorithm competitions. The easiest way to learn the DP principle is by examples. The current recipe contains a few DP examples, but unexperienced reader is advised to refer to other DP tutorials to make the understanding easier. You can find a lot of DP examples and explanations in an excellent tutorial Dynamic Programming: From novice to advanced by Dumitru. The purpose ...
(f) we want to trace the path from. Then we process the (f) state just like we did it in the DP, (u). To trace the DP solution path we need simply to repeatedly move to back-linked state until, of tracing the path back is rather simple., to the start. First we choose the final state (f) we want to trace the path from. Then we process the (f) state, /pasted, it requires backward-style DP for tracing the path. It is good only in the rare case when

Read more »

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

 
 
 
 
10.
By Kuroni, history, 18 months ago, In English
Codeforces Round #616 Editorial Hello everyone, this is the editorial for [contest:1290] and [contest:1291]! Along with the solution to each problem, we will have the theme and easter egg solution as well! I hope you all enjoyed our problems ( ´ ▽ ` )b [problem:1291A] Author: [user:265918,2020-02-02] <spoiler summary="Tutorial"> [tutorial:1291A] </spoiler> <spoiler summary="Implementation"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { int n; cin >> n; string s; cin >> s; int odd = 0; for (char c : s) if ((c - '0') & 1) odd++; if (odd <= 1) { cout << "-1\n"; continue; } int cnt = 0; for (char c : s) { if ((c - '0') & 1) { cout << c; cnt++; } if (cnt == 2) break; } cout << '\n'; } return 0; } ~~~~~ </spoiler> [problem:1291B] Author: [user:hugopm,2020-02-02...
+ oth.l); r = min(INF, r + oth.r); } } val[K]; pair trace(int u, ; if (ans != -1) { if (adj[i].size() == 1) { pair u = trace(adj[i, pair trace(int u) { if (dsu[u] < 0) { return {u, 0}; } else

Read more »

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

 
 
 
 
11.
By dyatkovskiy, history, 22 months ago, translation, In English
Slow man's solutions. 1238, E. Покупка клавиатуры — некоторые пояснения к legacy разбору Здесь пара комментариев (для себя и других) касательно [разбора](https://codeforces.com/blog/entry/70450) задачи [1238E](https://codeforces.com/contest/1238/problem/E) сделанного пользователями [user:PikMike,2019-10-12] и [user:Roms,2019-10-12]. Я там не сразу понял &mdash; как получается конечная формула для перебора символа. _( заморочился и написал код с трассировкой (см. под катом) )_ Давайте вначале придумаем общую суммарную формулу, которая отразит количество всех перемещений, и потом, используя нисходящий подход прийдем к решению. Двигаясь вправо, для каждого символа $s$, имеющего на клавиатуре позицию $x$ будем учитывать все перемещения между ним и символами слева.[cut] Так, очевидно, мы в итоге учтем все перемещения. Этот подсчет можно выразить вот так: $cnt = \sum_{x=1}^{n} \sum_{y=1}^{x-1} cnt_{xy} (x - y)$ Здесь $x$ и $y$ &mdash; это координаты символов на клавиатуре. А $cnt_{xy}$ &mdash; это соответсвенно общее количество переходов между символами на кла...
#define INFO 1 #define TRACE 2 void dumpMask(unsigned mask) { std::cout << "{"; bool first, #define LOG 0 #define INFO 1 #define TRACE 2, #if LOG >= TRACE std::cout << " res " << res << "\n"; #endif, #if LOG >= TRACE std::cout << " x " << (char)(x + 'a') << "\n"; std::cout << " prevr

Read more »

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

 
 
 
 
12.
By RNR, history, 2 years ago, In English
Warsaw debug template dissection Many times while debugging in contests, to trace the elements I use multiple functions like following, <spoiler summary="Code"> ~~~~~ #define trace(x) cout << '>' << #x << ':' << x << "\n" #define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n" #define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n" #define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n" #define PR(a,n) { cout<<#a<<" = "; REP(_,n) cout<<a[_]<<' '; cout<<"\n"; } #define PR1(a,n) { cout<<#a<<" = "; REP1(_,n) cout<<a[_]<<' '; cout<<"\n"; } #define _W(a,n) { REP(_,n) cout<<a[_]<<' '; cout<<"\n"; } ~~~~~ </spoiler> It's good if I can trace all using one method, I was looking for one single function/method for printing variables, vectors, etc. Watching [user:Errichto,2019-06-20] streams and this [tweet](https://twitter.com/ICPCLive/status/1113786495515725835) during ICPC live stream, I got ...
It's good if I can trace all using one method, I was looking for one single function/method, Many times while debugging in contests, to trace the elements I use multiple functions like, ~~~~~ #define trace(x) cout << '>' << #x << ':' << x << "\n" #define trace2(x,y) cout<< '>' << #x

Read more »

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

 
 
 
 
13.
By ItsNear, history, 3 years ago, In English
Are we close to machines solving ICPC problems? Hi, all, I with few other folks at [NEAR](http://near.ai/blog) work on teaching machines to program. A particularly exciting sub-project of that is teaching machines to solve competitive programming problems. In this post I would like to give a quick overview of where the state of the art is today, what the major challenges are, why this is not a popular area of research, and how the CodeForces community can help to address some of the issues the program synthesis community is facing today. We also have a certain budged allocated for this project, and we are paying to the CodeForces members who help us with some data annotation challenges. We have paid more than $10k in our first two annotation projects, and are launching three more projects today. Scroll to the end if you are interested. Competitive programming as a benchmark ====================================== With the emergence of deep learning, neural networks started performing almost at a human level in many ta...
have been exploring is feeding an execution trace instead. If the model made the mistake above

Read more »

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

 
 
 
 
14.
By kushal.p1699, history, 3 months ago, In English
Generating Subsets (Recursion) Hi all, I'm so excited to write my first blog here. Last week I was helping my friend in tracing the recursion problem called **Generating subset**. He had the code snippet, but he was not able to understand the flow of the program. So, I tried to explain the logic to him. I'm happy that, my explanation made him clear on his doubts. I thought of sharing my explanation on tracing this problem by writing a new blog. **Problem statement:** <br> Generate the subsets of given **N** elements using recursion. **Input:** <br> 1 2 3 **output:** <br> 1 2 3 <br> 1 2 <br> 1 3 <br> 1 <br> 2 3 <br> 2 <br> 3 <br> **Explanation:** <br> Subsets of [1,2,3] is null, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}. **code:** <br> ~~~~~ #include <bits/stdc++.h> using namespace std; vector<int> subset; void solve(int a[], int n, int index) { if(index == n){ // print the subset for(int i=0; i<subset.size(); i++){ cout << subset[i] << " "; ...
Hi all, I'm so excited to write my first blog here. Last week I was helping my friend intracing, Last week I was helping my friend in tracing the recursion problem called **Generating subset

Read more »

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

 
 
 
 
15.
By Hohol, 9 years ago, translation, In English
Codeforces Round #124 — editorial [problem:197A] If first player can't make first move (table is too small and plate doesn't fit it, i.e. $2r > min(a,b)$), second player wins. Else first player wins. Winning strategy for first player: place first plate to the center of table. After that he symmetrically reflects moves of second player with respect to center of table. If second player has move, first player has symmetrical move, too. If not, first player won. [problem:197B] From math lessons we know, that only higher degrees of polinomials matter in this problem. 1. If denominator degree is larger than numenator degree, answer is "0/1". 2. If numenator degree is larger, answer is infinity. But what is sign of this infinity? To get it consider signs of highest degree factors of polinomials. If they are same, answer is positive infinity, else --- negative infinity. 3. If degrees of numenator and denominator are equal, answer is $\frac{a_0}{b_0}$. To get irreducible fraction, you should divide this numbers b...
Let's trace Kruskal's algo on a graph of portals. On the first iteration, it will choose the edge

Read more »

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

 
 
 
 
16.
By MinakoKojima, 8 years ago, In English
Codeforces Round #201 Editorial ![ ](http://www.shuizilong.com/house/wp-content/uploads/2013/09/1.jpg) Overview ======== In DIV 1, there are 4 interesting problems together with a normal one. We think it is reasonable because we can't have a round fullly with intelligence. Problem A, C have weak pretests while others intended to be strong. About more then 200 participants solve A in the early 45mins, then a few of them start from C while most of the other start from B. Problem B is a rather standard problem, but if you're unfamiliar with the algorithm, it can be very hard. Problem C is a more intersting problem. As the name implies, there was [a similar version](http://codeforces.com/problemset/problem/251/C) in the previous round before, but this time it has a brand new constrains.(So here we have a psychology experiment: could different constrains make people thinking in a slightly different way?ww) The standard solution of problem C is $O((b-a) + nlogn)$. The first expected correct solution was writt...
, we should add 1 more dimension on the state to trace the growth of the virus. It can be done, When consider about the virus, we should add 1 more dimension on the state to trace the growth

Read more »

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

 
 
 
 
17.
By acash, history, 2 years ago, In English
Help needed in hackerrank problem Input: given n and m Task : For given n and m we have to calculate (n+m-2)C(n-1) mod 1000000007 where c is binomial coefficient Constraints : 1 <= T <= 10^3 1 ≤ m,n ≤ 10^6 [My solution](https://ideone.com/pbRGeq) [Accepted solution](https://ideone.com/OJyZwY) For the given test case(Which I is used in ideone) 1) Both are passing in ideone 2) My solution is failing on hackerrank(Segmentation fault) other one is passing on hackerrank Can anyone tell me why my solution is not getting accepted on hackerrank ? [Problem link](https://www.hackerrank.com/challenges/matrix-tracing/problem)
/challenges/matrix-tracing/problem)

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

 
 
 
 
18.
By ItsNear, history, 4 years ago, In English
Making machines write and execute code #1: Neural programmer-interpreters Hi, everyone, As I mentioned in the last post, myself and a friend of mine got very interested in how close we can get machines to writing software, and whether modern advances in Deep Learning can help us build tools that considerably improve the way people write, review and debug code. I want to start a series of posts discussing some interesting advances in using machine learning for both writing and executing code. This particular post is about a machine learning model proposed early last year by Scott Reed from University of Michigan, then an intern at Google DeepMind, called <a href=https://arxiv.org/pdf/1511.06279.pdf>Neural Programmer-Interpreters</a>. But before I go into the details, I would like to start with an ask. CodeForces and similar websites today host a vast amount of data that we would love to use to train our machine learning models. A particular challenge is that problem statements historically contain a lot of unnecessary information in an attempt to ...
should execute in the environment the correct operation from the actual executiontrace we, whether we should execute in the environment the correct operation from the actual executiontrace we

Read more »

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

 
 
 
 
19.
By dl720125, history, 20 months ago, In English
Runtime Error with C++:SIGTRAP Recently,I encountered a Runtime Error problem with C++. I wrote a code like this: ~~~~~ #include <bits/stdc++.h> #define MOD 1000000007ll #define maxn 1000000 using namespace std; int t,num[maxn+10]; char c[maxn+10]; vector<int> v[maxn+10],res; struct KMP { int n; vector<int> f; KMP(const char *s) : n(strlen(s)), f(n) { int p = -1; f[0] = -1; for (int i = 1; i < n; i++) { while (p != -1 && s[p + 1] != s[i]) p = f[p]; if (s[p + 1] == s[i]) p++; f[i] = p; } } int &operator[](int x) { return f[x]; } } ; inline void dfs(int x,int pr,int w) { res.push_back(x); while(w+1<res.size()&&res[w+1]<=x/2) w++; num[x]=w; for(int i=0;i<v[x].size();i++) if(v[x][i]!=pr){ dfs(v[x][i],x,w); } res.pop_back(); } int main() { cin>>t; for(int h=1;h<=t;h++) { memset(num,0,sizeof(num)); scanf("%s",c); KMP f(c); int len=strlen(c); f...
: **SIGTRAP trace/breakpoint trap**. So what is the problem? Can anyone work it out? Thanks, And when I debug it, it showed: **SIGTRAP trace/breakpoint trap**.

Read more »

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

 
 
 
 
20.
By ItsNear, 8 years ago, In English
MemSQL start[c]up Round 1 editorial **[Square and Rectangles](http://codeforces.com/problemset/problem/325/A)** Author: [user:SkidanovAlex,2013-07-14] What happens if the rectangles form an $N \times N$ square? Then these two conditions are necessary. 1) The area must be exactly $N \times N$. 2) The length of its sides must be $N$. That means, the difference between the right side of the rightmost rectangle &mdash; the left side of the leftmost rectangle is $N$. Same for topmost and bottommost rectangles. We claim that, since the rectangles do not intersect, those two conditions are also sufficient. This is since if there are only $N \times N$ space inside the box bounded by the leftmost, rightmost, topmost, and bottommost rectangles. Thus if the sum of the area is exactly $N \times N$, all space must be filled -- which forms a square. **[Stadium and Games](http://codeforces.com/problemset/problem/325/B)** Author: nika Suppose the "divide-by-two" stage happens exactly $D$ times, and the ...
a flood fill from any of the sea cell in the top row, you obtain a set of sea cells.Trace, Trace the southern boundary of these set of cells, and you obtain the sequence of land circumfering

Read more »

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

 
 
 
 
21.
By Peace_789, history, 14 months ago, In English
Negative Cycle in Directed weigthed graph Hello Everyone ... Today I was solving this problem ... **Problem statement** : You are given a directed weighted graph, and your task is to find out if it contains a negative cycle, and also give an example of such a cycle. I am aware of solving this problem using **Bellman Ford's Algorithm** , But I am trying another approach which is giving me WA in 1 Test Case (total 13 is there) . So , Can anyone point out whether this approach is correct or not ... and If it is correct then suggest me some modification otherwise give some counter examples where this code might fail. <spoiler summary="code"> ~~~~~ #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define mod 1000000007 #define check exit(0) #define nl cout<<endl; #define inp 30000 #define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> #define ll long long int #define trace(x) cerr<<#x<<" : "<<x<<endl; #...
,tree_order_statistics_node_update> #define ll long long int #define trace(x) cerr<<#x<<" : "<, > #define ll long long int #define trace(x) cerr<<#x<<" : "<

Read more »

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

 
 
 
 
22.
By Xellos, 7 years ago, In English
USACO Open 2014 The last USACO contest, that is, US Open, takes place this weekend. You can start the contest anytime in the 3-day window starting at [April 4th](http://www.timeanddate.com/worldclock/fixedtime.html?msg=USACO+Open&iso=20140404T12). Well, at least it's not during the next weekend (Crazy Weekend of April 2014, there's one every month :D). You'll be able to access the contest from the [USACO front page](http://usaco.org). You need to register for an account on the site to compete. I hope I'll be able to post my solutions again here [after the contest ends](http://www.timeanddate.com/worldclock/fixedtime.html?msg=USACO+Open%3A+no+more+coding&iso=20140408T16). I also hope that I'll be able to compete at all, because I'll be who knows where (I certainly don't :D) during the weekend and I wonder if there'll be Internet connection... Also note that this contest lasts 5 hours, unlike the previous ones. For the same number of problems. Problems and solutions (just gold so far; po...
$-coordinate). Trace the beam's path by remembering from which point in which direction it went and finding, ), and in every column (equal $x$-coordinate) also in sorted order (by $y$-coordinate).Trace the beam's path, Trace back the beam's path that could lead to it hitting point $\mathsf{B}$ from each of the 4

Read more »

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

 
 
 
 
23.
By AnasAbbas, history, 5 years ago, In English
Strange C++ behavior i had runtime error in this submission and i was going crazy finding where the error is after 2 hours of debugging and tracing .. i didn't find the problem .. i did something stupid and the problem got accepted .. i don't know why actually ... does any one knows where was the error in the first code ? ? and why C++ behaves like that run time error : http://codeforces.com/contest/706/submission/20629423 accepted :http://codeforces.com/contest/706/submission/20629645
hours of debugging and tracing .. i didn't find the problem .. i did something stupid, after 2 hours of debugging and tracing .. i didn't find the problem .. i did something stupid

Read more »

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

 
 
 
 
24.
By Tampere, 4 years ago, In English
Solutions to Codeforces Beta Round #40, A, B(prefix idea), C, D, E(Turan's theorem) A. Translation This is a simple problem. If the two strings have different length, then the answer must be "NO"; otherwise, we just reverse one of the strings and compare whether they are exactly the same or not. B. Martian Dollar A straightforward solution is to first enumerate the days when to sell, and for the i-th day, enumerate all days from the first one to the i-th one and find out the j-th day when one can buy with the cheapest price, where 1=<j<=i. Then, the money will be b%a[j]+b/a[j]*a[i], where "x/y" means "integer division". Finally, we output the maximum value as the answer. This solution has complexity O(N^2). However, we can further reduce it to O(N). The idea is to build another array p[N], where p[i] denotes the minimum value of a[0],a[1],...,a[i]. p[0] is initialized as p[0]=a[0], while p[i] can be computed as p[i]=min(a[i],p[i-1]), which takes O(N) complexity. Thus, if we sell on the i-th day, the money will be b%a[i]+b/p[i]*a[i], and the maximum one is jus...
; if F[r-1][c-1][z-b[r][c]%(k+1)]<=F[r-1][c+1][z-b[r][c]%(k+1)], then S[r][c][z]=c+1. When wetrace, When we trace back the steps, we can start from the first row, i.e., S[1][max_c][0], where max_c

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

 
 
 
 
25.
By Xellos, 8 years ago, In English
Samara SAU ACM ICPC 2013-2014 Quarterfinal Qualification Contest: Editorial ### A. The Power of the Dark Side (difficulty: easy) Let's sort the parameters of every Jedi: $a \ge b \ge c$. The "coverted" Jedi obviously wants to use his strongest 2 parameters ($a_k,b_k$) against the opponent's weakest 2 ($b_i,c_i$) to get 2 victories as assuredly as possible; besides, the optimal order is $a_k$ against $b_i$ and $b_k$ against $c_i$, because if he can win when using them in the opposite order, then he'll win after swapping them, too. So we want to find all Jedis that have $a_k > b_i$ and $b_k > c_i$ for all $i$. That's simple, because those are the same conditions as $a_k > B=\max(b_i)$ and $b_k > C=\max(c_i)$. When processing the input, we can count $B$, $C$ and then we just check for every Jedi if he satisfies these 2 conditions, in linear time. I decided during the contest to code a solution which is a bit slower, but more powerful &mdash; it allows us to answer stronger versions of this problem like "which Jedis can we choose, if we're satisfied with...
structure to have it allowed in this one — if we trace the path to the root, we'll get, — if we trace the path to the root, we'll get to a vertex that can't have access allowed

Read more »

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

 
 
 
 
26.
By piloop, 9 years ago, In English
Codeforces Round #119 Hello everyone, We are glad to invite you to participate in today’s round. Problems have been prepared by [user:poopi,2012-05-10], [user:Mohammad_JRS,2012-05-10], [user:Gerald,2012-05-10] and me. The hero of our contest is called “PMP”. It is actually the base of our team name through the last five years. The stories are metaphoric, but they have some traces in truth. This Codeforces round, is the last round before the incoming ICPC world final. Our best wishes for all participants of that contest, too. I want to specially thank [user:Gerald,2012-05-10] for his helps and advices in problem preparation, [user:Delinur,2012-05-10] for translation of statements into Russian and [user:MikeMirzayanov,2012-05-10] for this great system. And we have a modified version of [user:Burunduk1,2012-05-10] ’s advice: “to make the round even more interesting for **us**, read the statements of ALL problems.” :) We hope you enjoy the problems and have high ratings. **Update*...

Read more »

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

 
 
 
 
27.
By wrong, 11 years ago, In English
TopCoder High School Round3 <P>I participated in TopCoder High School Round3(TCHS2010 Round3). This blog is in codeforces, but I have English blog only here. So I will write some reports of other competitions.</P><P><BR></P><H2>Easy(250)</H2><P><STRONG>Problem Summary</STRONG><STRONG><BR></STRONG></P><P>There is a rectangular grid which has size <STRONG>width</STRONG>x<STRONG>height</STRONG>. Starting in the top left cell, tracing the border of the grid in clockwise order, writing a string (<STRONG>phrase</STRONG> + "."). Then you are to calculate subsection of this grid which has its top left corner at (<STRONG>x1</STRONG>, <STRONG>y1</STRONG>), and its bottom right corner at (<STRONG>x2</STRONG>, <STRONG>y2</STRONG>).</P><P><STRONG>Solution</STRONG></P><P>It's easy to calculate what is the letter in position (x, y). So you can simply iterate x from x1 to x2, and y from y1 to y2.</P><P><BR></P><H2>Medium(550)</H2><P><STRONG>Problem Summary</STRONG></P><P>There is a paper which a maze is written on both side. The...
, tracing the border of the grid in clockwise order, writing a string (phrase, >. Starting in the top left cell, tracing the border of the grid in clockwise order, writing a string

Read more »

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

 
 
 
 
28.
By I_am_Drew, history, 13 months ago, In English
Hashing a list (vector) I have come up with (invent) a new list hashing algorithm that you can use to hash lists whenever you want. The secret is simple: Suppose B is a dict (map) ar = list (vector) Then for a list consisting of two elements, we need to match this number: B[pow(ar[0], 37, 1000000007) + pow(ar[1], 43, 1000000007)] = [ar[0], ar[1]] So we have mapped a list of 2 elements to a number!!! The more items in the list, the further we can add pow(ar[i], P_i, 1000000007), where i is the trace. index in the list (vector), and P_i is the trace. Prime number. With this hashing of lists (vectors), we can with a probability of 95-99% drive the problem to OK without much bother!!! I hope the article was useful!
is the trace. index in the list (vector), and P_i is the trace. Prime number., !!! The more items in the list, the further we can add pow(ar[i], P_i, 1000000007), where i is thetrace

Read more »

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

 
 
 
 
29.
By asaleh, history, 5 years ago, In English
Where does the term "bug" come from? Where does the term "bug" come from? ![ ](http://content.screencast.com/users/aboshra/folders/Snagit/media/e46bd9b1-2f48-493a-8d81-38a8268f9248/10.31.2016-09.05.png) There's a story of a Harvard Mark II machine in which on September 9, 1947, a moth got stuck in the relay. The moth got carbonized and then caused a short circuit in the machine, which caused the machine to break. Technicians retrieved the moth from the relay and this was then recorded as the first bug actually being found in a computer. The bug is now on display at the Smithsonian in Washington. The term "bug" as you can see was already known in 1947, and it's actually much older than that. You can even trace it back to Shakespeare who used the term in order to describe some form of spector sitting on the chest of people in the night and causing them nightmares.
can even trace it back to Shakespeare who used the term in order to describe some form of spector, You can even trace it back to Shakespeare who used the term in order to

Read more »

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

 
 
 
 
30.
By murderousbread, history, 2 years ago, In English
Grasping DP I have been trying for almost a month now to try and understand DP. I started of with first ensuring that I understand recursion correctly. For this I practiced Recursive segment tree problems, And a few basic recursion problems. In addition, I even switched to recursive binary search, which I honestly dislike, just to ensure that I am not lacking in my understanding of recursion. Next, I started reading tutorials that introduced DP. Ones like this one, https://www.topcoder.com/community/competitive-programming/tutorials/dynamic-programming-from-novice-to-advanced/ , https://www.hackerearth.com/practice/algorithms/dynamic-programming/introduction-to-dynamic-programming-1/tutorial/ , and a few others. The problem: While I am able to understand the approach taken in the problems that I have seen, I am unable to apply it myself. To put it differently, I understand the solutions, but am unable to come up with such solutions on my own. And, some of the harder DP problems I am unable ...
even when I read the tutorial multiple times. Its only when I read the code, the tutorial,trace, , the tutorial, trace a few test cases that I just start to understand how the program works, leaving me very

Read more »

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

 
 
 
 
31.
By christal, 8 years ago, In English
bulgari replica Return to the source, the ocean J12 all started. Sailed in 2010 J12 Marine confirmed this series of orthodox character watches for diving, are also considered to trace the origin of the J12. For people <a href=http://www.tonewatches.com/Swiss.html><b>rolex swiss replica watches</b></a> who want to conquer the ocean, must first be impressed by this "spray white" Nautical style J12. Watch the bit body <a href=http://www.tonewatches.com/TAG-Heuer.html><b>fake tag heuer watches</b></a> with a white table with a little blue of the ocean and has a professional diving watch features, a sense of all-round display of the ocean. High-tech precision ceramic case with sapphire crystal and double-sided anti-glare clear, colorless coating to make it to the water to keep the elegant and chic casual dynamic, unidirectional rotating panels inlaid with sapphire glass surface of the groove engraved ring, 60 minute scale, especially rendered in blue, with a view to facilitate the owner to be able to accur...
of orthodox character watches for diving, are also considered to trace the origin of the J12

Read more »

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

 
 
 
 
32.
By MarioYC, 9 years ago, In English
Codeforces 166B — Polygon Although I didn't passed this problem during the contest, I really enjoyed it. The reason is I never I hadn't thought before about solving "point in a polygon" queries in a more efficient way other than using O(n) algorithm for every query. But after getting hacked, and trying to optimize my code, I noticed something nice. If we use the ray tracing algorithm for one point inside a convex polygon, then we worry bout at most four sides of the polygon every time (I assume we are using the [Ray casting algorithm](http://en.wikipedia.org/wiki/Point_in_polygon)), and this combines really nicelly with a sweep line approach, in which you only keep the interesting sides, and discard them when they can't be intersected by the points that follow. Implementation : [submission:1398412]
code, I noticed something nice. If we use the ray tracing algorithm for one point inside a convex, the ray tracing algorithm for one point inside a convex polygon, then we worry bout at most four sides

Read more »

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

 
 
 
 
33.
By arya5691, 9 years ago, In English
Round #145 Div 2 — JAVA Runtime Error ? Hi, I coded the following solution to Problem H of Round #145 Div 2 &mdash; Merging 2 Decks : Solution Link : http://codeforces.com/contest/234/submission/2418169 Problem Link : http://codeforces.com/contest/234/problem/H . When I submit this solution, I get the message "Runtime Error on Test 1". However my program runs properly for test case 1 locally, as well as on IDEONE. Does anyone have any idea what the problem could be ? Also, I submitted a solution using a Try Catch block to catch any Runtime exception, and I am printing the Stack Trace to STDOUT. ( Link : http://codeforces.com/contest/234/submission/2418290 ) However, now I simply get Wrong Answer on Test Case 1 and I can't see what exactly my program is outputting :( Does anyone know any workaround to figure out exactly what's wrong ? Any feedback would be much appreciated! Thank you :)
block to catch any Runtime exception, and I am printing the Stack Trace to STDOUT. ( Link : http, printing the Stack Trace to STDOUT.

Read more »

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

 
 
 
 
34.
By nivin, 7 years ago, In English
Image Processing (Gesture Recognition & Classification ) Hi all, Problem Statement I need to recognize the word when a sign is performed. I am currently working on a project for Indian Sign Language Recognition. I've segmented the head and hand regions. I've used particle filter to track these 3 regions and I obtaining the trace of each of these gestures as the feature(using centroid of each region). After obtaining the trace , can I use DTW(dynamic Time Warping Algorithm) to classify the gestures?? Or can you suggest some other method?
and hand regions. I've used particle filter to track these 3 regions and I obtaining thetrace, regions. I've used particle filter to track these 3 regions and I obtaining the trace of each

Read more »

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

 
 
 
 
35.
By ahmed_aly, 8 years ago, In English
8289
output and code reading. This forces you to search bugs not by tracing the program but by careful

Read more »

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

 
 
 
 
36.
By Edvard, history, 6 years ago, translation, In English
22276
" face="Times">If you trace

Read more »

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

 
 
 
 
37.
By gauti786, history, 4 years ago, In English
52628
let me trace my code on example "

Read more »

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

 
 
 
 
38.
By r_sazid77, history, 4 years ago, In English
56291
find the reason in a few seconds (since we get full stack trace with it).

Read more »

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

 
 
 
 
39.
By iamdumb, 6 years ago, In English
Dijktra's 20C ? Can anybody please help me with [this question](http://codeforces.com/problemset/problem/20/C).I know how to calculate shortest path but I have no idea how to actually trace the nodes in the shortest path.What modification to naive dijktra's has be made?
know how to calculate shortest path but I have no idea how to actually trace the nodes in the shortest

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it