Skip to content

Conversation

@Krishna200608
Copy link
Contributor

Issue: #548

Problem: The Tag Game (Codeforces 813C)
Approach: Double BFS to calculate distances from Alice and Bob. Optimized for max depth reachable by Bob.
Time Complexity: O(N)

Submission Link:
https://codeforces.com/contest/813/submission/356727323

Screenshot of the submission:
image

Copilot AI review requested due to automatic review settings January 7, 2026 08:12
@OpenGitBot
Copy link

Hey @Krishna200608

Thanks for opening this PR 🚀. Mentor will review your pull request soon and till then, keep contributing and stay calm.

Thanks for contributing in OpenCode'25 ✨✨!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR solves Issue #548 by implementing a solution to "The Tag Game" problem from Codeforces (Contest 813, Problem C). The solution uses a double BFS approach to calculate distances from both Alice (starting at node 1) and Bob (starting at node x) to determine the maximum number of moves Alice must make when Bob plays optimally to delay being caught.

Key Changes:

  • Implements a graph BFS solution that runs two BFS traversals to compute distances from both players' starting positions
  • Identifies nodes Bob can reach before Alice and calculates the maximum distance Alice must travel (2 × distance from root)
  • Achieves O(N) time complexity as required for the problem constraints

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants