ayanasamuel's blog

By ayanasamuel, history, 18 minutes ago, In English

FOCUS-ASTU-TECH-COMMUNITY-ADVANCED-CP-CONTEST-1

Hello everyone!

Welcome to the editorial for FOCUS-ASTU-TECH-COMMUNITY-ADVANCED-CP-CONTEST-1. Our topics this season were Recursion, Trees and Linked Lists, so this set mixes classic implementation and constructive problems with problems where those three ideas give the cleanest solution (tree depth, tree construction, tree DP, recursive search and backtracking, and walking along chains of pointers).

Below you will find hints, tutorials, and solutions for each problem. We used spoiler tags to keep things clean. Try to solve it yourself before clicking!

Happy coding!

Problem-A:734480A - Tatar TV Show

Tags: Linked List Math Parity Constructive
Difficulty: ⭐⭐ (Easy)

This problem looks like a game on a string, but hidden inside it are several linked lists.

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: One XOR per remainder

Problem-B:734480B - Erasing Zeroes

Tags: Strings Greedy Implementation Recursion
Difficulty: ⭐ (Very Easy)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Recursion (peel the ends)

Problem-C:734480C - Party

Tags: Trees Recursion DFS Linked List
Difficulty: ⭐⭐ (Easy)

A very good first problem on tree depth.

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Walk up the manager pointers (Linked List)

Problem-D:734480D - Christmas Spruce

Tags: Trees Implementation Counting
Difficulty: ⭐⭐ (Easy)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Count leaves with one array

Problem-E:734480E - Omkar and Heavenly Tree

Tags: Trees Constructive
Difficulty: ⭐⭐⭐ (Medium)

A constructive problem: you must build a tree that satisfies all the conditions. Any valid tree is accepted.

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Think of it as a tree with one special vertex

Problem-F:734480F - Bear and Compressing

Tags: Recursion Backtracking Brute Force Strings
Difficulty: ⭐⭐⭐ (Medium)

This is a pure recursion / backtracking problem: the constraints are tiny, so we simply try everything.

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Run it backwards

Problem-G:734480G - Idiot First Search

Tags: Trees DFS Dynamic Programming Recursion
Difficulty: ⭐⭐⭐⭐ (Hard)

The hardest problem of the set, but it follows the exact pattern we learned in the Trees lectures: compute a value from the children up (post-order), then push another value from the parent down (pre-order).

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Plain recursion (two DFS functions)

Problem-H:734480H - Undoubtedly Lucky Numbers

Tags: Recursion Backtracking DFS Brute Force Implementation
Difficulty: ⭐⭐⭐ (Medium)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Choose the two digits first

Full text and comments »

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

By ayanasamuel, 8 months ago, In English

FOCUS-ASTU-TECH-COMMUNITY-CONTEST-1

Hello everyone!

Welcome to the editorial for our mashup contest. We selected a mix of classic implementation, greedy, and constructive problems. The goal was to test logical thinking without getting bogged down in heavy data structures.

Below you will find hints, tutorials, and solutions for each problem. We used spoiler tags to keep things clean. Try to solve it yourself before clicking!

Happy coding!

Problem-A:679752A - Bear and Big Brother

Tags: Math Brute Force Simulation
Difficulty: ⭐ (Very Easy)

This is a classic implementation problem that tests your ability to simulate a process step-by-step.

Understanding the Problem
Hint
Tutorial
Solution (Python)

Problem-B:679752B - Tanya and Stairways

Tags: Arrays Brute Force Implementation
Difficulty: ⭐⭐ (Easy)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Lookahead

Problem-C:679752C - Joysticks

Tags: Brute Force Math Greedy Simulation
Difficulty: ⭐⭐ (Easy)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Simulation with Sorting

Problem-D:679752D - Polycarp's Practice

Tags: Arrays Sorting Greedy Implementation
Difficulty: ⭐⭐⭐ (Medium)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Threshold Value Counting

Problem-E:679752E - Build a Contest

Tags: Arrays Maps Simulation Greedy
Difficulty: ⭐⭐⭐ (Medium)

Understanding the Problem
Hint
Tutorial
Solution (Python)
Alternative Approach: Using Dictionary (Map)

Full text and comments »

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