pacha2880's blog

By pacha2880, history, 3 months ago, In English

In this blog post, I will share my approach to reading problems during team competitions, such as ICPC. This method is how I personally tackle problem reading during competitions, but it doesn't necessarily mean that the entire team should follow this approach strictly.

I hope you find this useful :)

How to Read a Problem

In the context of competitive programming, particularly during a competition, problem reading can be categorized into three different methods depending on the speed:

Initial Scan of a Problem

Taking a quick glance at a problem can sometimes give hints about which problem to read first. The simplicity of the statement and the sample cases might suggest that it’s an easy problem. However, in some cases, these seemingly simple problems can turn out to be the most challenging. Ultimately, selecting the easiest problem after just an initial scan successfully comes with practice, but it doesn’t always work.

Quick Reading

A quick reading approach doesn’t involve deeply understanding every detail in the problem statement or how the test cases work. Rather, it’s about getting a general and precise idea of what the problem is about—what it provides and what it asks for. Focusing only on abstracting the basic information about the problem reduces the reading time, and reading in this way can be useful if you want to quickly read through a couple of problems to decide which one to invest time in. This can help you find an easy problem more quickly.

During a quick read, keep in mind the following details:

  • Identify if the initial paragraphs are a story unrelated to what the problem asks for (detect where the actual problem statement begins).
  • Pay attention to every instance where a number or variable appears.
  • Look for definitions or descriptions of procedures, which are often listed.
  • Pay close attention to the last sentences of the statement, as they usually summarize what the problem is asking for in a few words.
  • Pay attention to the limits provided in the input description, as this often hints at what techniques or algorithms can be applied to solve the problem.
  • Pay attention to the output description, as this also typically summarizes in a few words what the problem is asking for.

If you happen to come across one of the easier problems and read it quickly and lightly, with practice and experience, you might find a solution to the problem while reading it, even without paying much attention to unimportant details. (After much practice, this might also happen when you are just doing an initial scan of a problem.) Therefore, it is useful to develop a quick reading method that doesn't capture all the details but still tries not to miss the essential parts of the statement.

Detailed Reading

A detailed reading aims to obtain a deep understanding of the problem, ensuring that no detail escapes and that every sentence is read and thought through carefully—sometimes even read multiple times. It's a good practice to note down the most important details of the problem on a separate sheet of paper, such as the factors involved and the limits of the inputs. It's essential to pause every so often and ask yourself questions like:

  • What does this really mean?
  • Could this lead to a special case?
  • Could this detail be crucial for finding the solution to the problem?
  • Is this information useful?

It is crucial to question every possible detail and answer all the questions you can think of regarding the statement. A poor reading comprehension can lead to disastrous results. Failing to detect details or assuming things about the problem that are not specified in the statement results in solving a completely different problem and therefore losing valuable time.

Two key principles to keep in mind are:

  1. "If something is not written in the statement, it doesn't mean it's false."
  2. "If something is not written in the statement, it doesn't mean it's true."

It’s easy to make mistakes when making assumptions about the information detailed in the statement. A very common mistake is assuming that the input data is sorted in ascending order, just because the test cases are given that way, even though the statement does not specify this.

When to Apply Detailed Reading

Ideally detailed reading should always be done, but it is especially necessary when you understand that the problem is not easy and you have some respect for it. Additionally, it is mandatory to read the problem statement in detail after coding and receiving a "Rejected" verdict with no clear suspicion of what might have gone wrong. It is also recommended to re-read the problem if no solution idea comes to mind when looking for a solution. This allows you to perhaps find new details that were not recognized before.

Full text and comments »

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

By pacha2880, history, 22 months ago, In English

What is the best way to solve this problem?, I have a solution in $$$O(n^4)$$$

Given are $$$N$$$ points $$$(x_i, y_i)$$$ in a two-dimensional plane. Find the minimum radius of a circle such that all the points are inside or on it.

Link to the problem https://atcoder.jp/contests/abc151/tasks/abc151_f

thanks in advance.

Full text and comments »

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

By pacha2880, history, 5 years ago, In English

could someone please help me with this problem? given n circles (n <= 500000), count the number of circles that have a common point. it's guaranteed that the circles don't overlap.

here's the complete statement: http://coj.uci.cu/24h/problem.xhtml?pid=4161〈=es

thanks in advance

Full text and comments »

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