Блог пользователя Shayan

Автор Shayan, 5 месяцев назад, По-английски

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, not as a substitute for the text editorial.

2009A — Minimize!

Video

2009B — osu!mania

Video

2009C — The Legend of Freya the Frog

Video

2009D — Satyam and Counting

Video

2009E — Klee's SUPER DUPER LARGE Array!!!

Video

2009F — Firefly's Queries

Video

2009G — Yunli's Subarray Queries

Video

Полный текст и комментарии »

Разбор задач Codeforces Round 971 (Div. 4)
  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, not as a substitute for the text editorial.

2007A — Dora's Set

Video

2007B — Index and Maximum Value

Video

2007C — Dora and C++

Video

2007D — Iris and Game on the Tree

Video

2007E — Iris and the Tree

Video

2007F — Eri and Expanded Sets

Video

Полный текст и комментарии »

Разбор задач Codeforces Round 969 (Div. 2)
  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски

Hi,

This is our second stream on Graph Algorithms, where we continued covering the basics. The next stream will be more challenging, as we’ll solve several problems from Codeforces. As mentioned earlier, in future streams, I plan to explain some of the hardest graph problems I’ve ever encountered.

If you’re already at an advanced level, this topic stream is not for you.

Bipartite Graphs

In this section, I discussed bipartite graphs: what they are, the condition for a graph to be bipartite, and how to find the two parts if a graph is bipartite.

Video

Terminology Overview: Walk, Path, and Cycle

To continue our discussion, it’s important to familiarize ourselves with some basic terminology. Here, I define what a walk, a path, and a cycle are.

Video

Find distances and BFS

In this section, we discuss how to find the distance between two vertices in an undirected graph. I first explain the algorithm and then reveal its name—BFS.

Video

Solving a 1600 Difficulty BFS Problem from Codeforces

In this section, we solve a problem that’s perfect for implementing BFS:

https://codeforces.me/problemset/problem/601/A

Video

I hope this stream and the consequent ones will be helpful. Feel free to criticize. I'll do my best to address any issues.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +17
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски

Hi,

We had our first topic stream on graph algorithms yesterday.

Since this was the first stream on this topic, I started with the very basics. We’ll cover more advanced topics in the upcoming streams. My goal is to eventually cover every graph algorithm from basic to advanced. In future streams, I plan to explain some of the hardest graph problems I’ve ever encountered.

If you’re already at an advanced level, the first topic stream is not for you, as I started from the very beginning to ensure that no prior knowledge is needed to follow along.

What is a Graph

In this section, I introduce what a graph is and how it can be useful. I also discuss the basic types of graphs (un/directed, un/weighted).

Video

How to Store a Graph

The next question is how we can take a graph as input and store it. This is the first step we must take before running any algorithm on the graph.

Video

Connectivity in Graphs and DFS

Here, I discuss the connectivity of a graph, and we solve a problem related to it. At the end, I mention that what we did is called DFS.

Video

Solve a 1400 Difficulty Graph Problem from Codeforces

In this section, we solve a graph problem with a difficulty level of 1400 from Codeforces.

The link of the problem: https://codeforces.me/problemset/problem/505/B

Video

I hope this stream and the consequent ones will be helpful. Feel free to criticize. I'll do my best to address any issues.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, not as a substitute for the text editorial.

2001A — Make All Equal

Video

2001B — Generate Permutation

Video

2001C — Guess The Tree

Video

2001D — Longest Max Min Subsequence

Video

2001E1 — Deterministic Heap (Easy Version)

Video

Полный текст и комментарии »

Разбор задач Codeforces Round 967 (Div. 2)
  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, and not as a substitute for the text editorial.

2004A — Closest Point

Video

2004B — Game with Doors

Video

2004C — Splitting Items

Video

2004D — Colored Portals

Video

2004E — Not a Nim Problem

Video

2004F — Make a Palindrome

Video

Полный текст и комментарии »

  • Проголосовать: нравится
  • +21
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски
Разбор задач Codeforces Round 966 (Div. 3)
  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

Автор Shayan, история, 6 месяцев назад, По-английски
  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски
Разбор задач Codeforces Round 965 (Div. 2)
  • Проголосовать: нравится
  • +20
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски

Hi,

As always, we have topic streams on Fridays from 12-14 GMT. Today was the second topic stream on Dynamic Programming. Here are the topics covered in this livestream:

  1. The idea of updating dp in two directions (Sending a Sequence Over the Network)
  2. Keeping our states for matching subsequences (Easy Problem)
  3. Importance of ordering in updating DP (Gargari and Permutations)
  4. Keeping max values to optimize DP (Choosing Balls)
  5. Memory optimization and moving in two directions (Pigs and Palindromes)

I will write the highlights of the livestream here, embedding specific parts of the videos so you can easily watch the sections you’re interested in. You can ask questions about any part here, on YouTube, or in our Telegram Channel. The main discussion thread is in our Telegram Channel.

Updating DP in two directions

In DP problems, sometimes we calculate dp[i] when we reach i by using smaller instances (j < i). Other times, when we reach i, we assume that we already have dp[i] and update the larger instances (j > i). In some cases, we can do both simultaneously.

Sending a Sequence Over the Network

Video

Keeping our states for matching subsequences

In this problem, we want to remove certain characters to ensure that the string "hard" does not appear as a subsequence in our string. We explore how to maintain states that track how many characters of "hard" have already been matched and how this helps us solve the problem efficiently.

Easy Problem

Video

Importance of ordering in updating DP

In this problem, we see how the order of calculating DP values can be important and how to find the right ordering.

Video

Gargari and Permutations

Keeping max values to optimize DP

In this problem, we first come up with an O(n^2) DP solution. Then we optimize it by keeping track of the two maximum DP values. This way, we can update dp[i] in O(1) instead of O(n).

Choosing Balls

Video

Memory optimization and moving in two directions

Here, in addition to the idea of considering the diagonals of a grid and maintaining our states, we see how we can optimize memory by taking one of the dimensions modulo 2.

Pigs and Palindromes

Video

Let me know your opinions! Together we can make the livestreams better.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +27
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски
Разбор задач Codeforces Round 964 (Div. 4)
  • Проголосовать: нравится
  • +24
  • Проголосовать: не нравится

Автор Shayan, 6 месяцев назад, По-английски
  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

Автор Shayan, 7 месяцев назад, По-английски

Hi,

Today, I had my first topic stream on Dynamic Programming. The stream lasted for two hours, and this was the plan for the first livestream:

  1. Start with the basics of Dynamic Programming: the logic behind it and when to apply it.
  2. Boredom — difficulty 1500
  3. Consecutive Subsequence — difficulty 1700
  4. Red-Green Tower — difficulty 2000
  5. Winter is here — difficulty 2200

I will write the highlights of the livestream here, while embedding the specific parts of the videos so that you can easily watch the parts you want. You can ask questions about any part here, on YouTube, or in our Telegram Channel. The main discussion thread is in our Telegram Channel.

The Basics of Dynamic Programming

In this part, I talk about what Dynamic Programming is and why we might want to use it. I explain how to figure out if we can apply DP to a problem. Of course, as an example, I discuss the Fibonacci sequence—who doesn’t use Fibonacci when explaining DP? I tried to skip unnecessary details and keep the focus on the most important points.

455A — Boredom

This problem helps to build intuition on how DP works. It’s an example of defining states and solving the main problem using those states. In this case, we define dp[i] as the answer when considering only the numbers from 1 to i and ignoring the rest.

Video

977F — Consecutive Subsequence

This is another problem that helps with the idea of defining subproblems as the different cases that contribute to our final answer. Here, we define dp[i] as the answer if the last chosen number in our subsequence is i.

Video

478D — Red-Green Towers

This problem combines a greedy algorithm to find the best value for h and defines subproblems like (i, j). This states how many ways we can have a pyramid of height i using j red blocks.

Video

839D — Winter is here

This one features number theory. We want to find the value of dp[x] as the number of possible subsets whose GCD is x. To do this, we first find the number of subsets where one of their common divisors (not necessarily the maximum one) is x. From there, we determine the number of subsets whose GCD is x.

Video

Let me know your opinions! This is your livestream, and together we can make it better.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +33
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски
  • Проголосовать: нравится
  • +35
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски

Today, I wasn’t at home. I was at Stevens University in New Jersey. So, the quality was not as usual and I had to keep the livestream shorter (solved only A-E), but it was a new format either way. I tried to show some views of New York City (which is on the other side of the river) to make up for it.

1991A — Maximize the Last Element

1991B — AND Reconstruction

1991C — Absolute Zero

1991D — Prime XOR Coloring

1991E — Coloring Game

Making Up for the Quality by Showing Some Scenery from New York

Полный текст и комментарии »

Разбор задач Pinely Round 4 (Div. 1 + Div. 2)
  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски
Разбор задач Codeforces Round 962 (Div. 3)
  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски
Разбор задач Codeforces Round 961 (Div. 2)
  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски
Разбор задач Codeforces Round 960 (Div. 2)
  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Shayan, 7 месяцев назад, По-английски
  • Проголосовать: нравится
  • +48
  • Проголосовать: не нравится

Автор Shayan, 7 месяцев назад, По-английски
Разбор задач Codeforces Round 958 (Div. 2)
  • Проголосовать: нравится
  • +33
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски
Разбор задач Codeforces Round 957 (Div. 3)
  • Проголосовать: нравится
  • +36
  • Проголосовать: не нравится

Автор Shayan, история, 7 месяцев назад, По-английски
  • Проголосовать: нравится
  • +126
  • Проголосовать: не нравится

Автор Shayan, история, 8 месяцев назад, По-английски
  • Проголосовать: нравится
  • +62
  • Проголосовать: не нравится

Автор Shayan, 8 месяцев назад, По-английски
  • Проголосовать: нравится
  • +91
  • Проголосовать: не нравится

Автор Shayan, 8 месяцев назад, По-английски

Hi,

From now on, we are going to provide video editorials for Codeforces rounds. So, Codeforces rounds are not going to be limited to text editorials, but also video editorials!

We want to seek feedback and try to improve these video editorials as much as possible. We will try different ideas like recorded videos and livestreams to see which one helps you the best. So, please help us make a better content for you!

The blog will be shortly accessible in contest materials.

1982A — Soccer

1982B — Collatz Conjecture

1982C — Boring Day

1982D — Beauty of the mountains

1982E — Number of k-good subarrays

I hope it helps!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +56
  • Проголосовать: не нравится