IcpcTanta's blog

By IcpcTanta, history, 20 months ago, In English

Introduction

Contest #2 was an exciting competition with strong participation from multiple contestants. The contest featured four problems (A, B, C, D), and the results were as follows:

lilpluton was the first to solve A.

__baozii__ was the first to solve B.

AkbarKING was the first to solve C.

MR_NoSolution was the first to solve D.

The fastest full completion was achieved by __baozii__ (88 minutes).


Standings

Rank User Solved Penalty
1 __baozii__ 4 88
2 AkbarKING 4 89
3 TripleMO 4 120
4 MR_NoSolution 4 150
5 gholyo 4 204
6 ammahmed004 4 342
7 Mostafa_Alaa99 3 37
8 MMO 3 54
9 ibluefox 3 85
10 abrakadbra 3 86

Join our group to participate in future contests and discussions: Codeforces group and Telegram group


Problem A:

Author: Mohamed_Shosha

Tutorial
Code

Problem B:

Author: X_SeL1M

Hint
Solution
Code

Problem C:

Author: X_SeL1M

Tutorial
Code

Problem D:

Author: X_SeL1M

Tutorial
Code

Full text and comments »

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

By IcpcTanta, history, 20 months ago, In English

Introduction

Contest #1 was an exciting competition with strong participation from multiple contestants. The contest featured four problems (A, B, C1, C2), and the results were as follows:

EyadBT achieved the first accepted solution in A, C1, and C2.

Fostok was the first to solve B.

The fastest full completion was achieved by EyadBT (67 minutes).


Standings

Rank User Solved Penalty
1 EyadBT 4 67
2 TripleMO 4 118
3 Mazen_Ghanayem 4 134
4 taha06 4 203
5 AhmedElseyoufi 4 207
6 abdelaal_03 4 229
7 ALFarouK 4 253
8 Fostok 4 261
9 AliRagab313 4 262
10 AL70SSAIN 4 263

Join our group to participate in future contests and discussions: Codeforces group and Telegram group


Problem A:

Hint

Notice that the input is ignored and doesn’t affect the output.

Solution

The problem simply requires printing three predetermined answers regardless of the input provided. Even though a string is read, it is not used in any computation, and the program always outputs "ICPC TANTA", "Hassan Fathi", and "Mo Salah" in order.


Problem B:

Hint

  1. Look for the first adjacent pair where the right character is smaller than the left.
  2. If none found, check for any pair of equal adjacent characters to swap.
  3. If the string is strictly increasing, swap the last two characters as a fallback.

Solution

The approach is to perform exactly one adjacent swap that minimizes the lexicographical order. We first scan the string to find the earliest index where s[i+1] < s[i] and swap these two characters, as this immediately reduces the string’s lexicographical value. If no such pair exists (i.e., the string is non-decreasing), we then look for adjacent equal characters, and swapping them, although it doesn't change the string, still satisfies the one-swap requirement. Finally, if neither condition is met—meaning the string is strictly increasing—we swap the last two characters to ensure an operation is performed.


Problem C1:

Hint

  1. Use DFS/backtracking while marking visited cells to avoid revisiting and count path lengths accurately.
  2. Check if revisiting cells forms a cycle to leverage the full color frequency for scoring.

Solution

The solution involves performing a DFS from every unvisited cell in the grid to explore paths that can be formed by moving to adjacent cells with the same color. During the DFS, we maintain a count of the visited cells, updating the maximum score if a longer simple path is found. If the DFS detects a cycle—indicated by reaching a cell that has already been visited from the current path—then the score for that cycle is taken as the total frequency of that color in the grid. The final answer is the maximum score achieved either through a simple path or a cycle, computed by iterating over all cells and performing the DFS while ensuring that cells are marked visited appropriately to avoid reprocessing.


Problem C2:

Hint

If a cycle is found, use the full count of that color; otherwise, compute the component’s diameter via double DFS.

Solution

The solution processes the grid by exploring connected components of cells sharing the same color. For each component, it performs a DFS to mark all cells and detect if a cycle exists (i.e., a neighbor is revisited that isn’t the immediate predecessor). If a cycle is detected, the maximum score for that color is the total number of dots of that color in the grid. Otherwise, the algorithm computes the longest simple path (or "diameter") in that component using a two-phase DFS, where the first DFS finds the farthest point from an arbitrary starting cell, and the second DFS from that farthest cell determines the diameter. Finally, the answer is the maximum score obtained among all colors.

Full text and comments »

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

By IcpcTanta, history, 20 months ago, In English

Schedule & Format

The Ramadan Marathon is a competitive programming series organized by the ICPC Tanta Community. The marathon consists of two contests per week, held on Sundays and Wednesdays at 10:00 PM Cairo Time. Each contest lasts for one hour and features 3 to 4 problems with increasing difficulty, ensuring a progressive challenge for all participants.

Who Can Join?

This marathon is open to everyone, regardless of skill level. Whether you're a beginner looking to improve or an experienced competitor aiming to refine your problem-solving skills, you’re welcome to participate .

Discussion & Community

To foster learning and engagement, we provide:

  • A Telegram group for post-contest discussions, solution sharing, and problem-solving strategies.

Problemset & Preparation

All problems are designed by students from the ICPC Tanta Community, ensuring fresh and creative challenges. The problems will cover a variety of topics, helping participants improve their algorithmic thinking and problem-solving skills .

Kickoff Date

The first contest will take place on Sunday, the 2nd of Ramadan . Get ready for an exciting and competitive experience Stay tuned for more details. Make sure to join the Telegram group and follow the Codeforces group for updates

Full text and comments »

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