Open In App

Contest Experiences | Codeforces: CodeTON Round 5 (Div. 1 + Div. 2)

Last Updated : 09 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

ABOUT THE CONTEST:

  • This CodeTON Round 5 was conducted on 24 Jun 2023 by codeforces for (Div. 1 + Div. 2) Participants.
  • In this Contest, there are a total of 9 problems, and 2 hours and 15 minutes are given to you to solve this problem.
  • The penalty for each wrong submission was 10 minutes.

Link of the Contest: https://codeforces.com/contest/1842

OVERVIEW OF ALL CONTEST PROBLEM:

Problem Name

Difficulty

Approx time to solve for me

Number of submissions by me

A. Tenzing and Tsondu

Easy-Medium

5 – 10 minutes

1

B. Tenzing and Books

Easy-Medium

10 – 15 minutes

1

C. Tenzing and Balls

Medium

10 – 15 minutes

1

D. Tenzing and His Animal Friends

Medium

10 – 15 minutes

2

E. Tenzing and Triangle

Medium

10 – 15 minutes

1

F. Tenzing and Tree

Hard

G. Tenzing and Random Operations

Hard

H. Tenzing and Random Real Num

Hard

I. Tenzing and Necklace

Hard

LET’S DISCUSS THE QUESTIONS:

Problem A. Tenzing and Tsondu

To solve this use a recursive approach to simulate the game. Consider all possible moves by choosing pairs of monsters from both players. Update the ability values of the monsters and simulate the game recursively. Keep track of the game state and return the result to find the optimal outcome for Tsondu or Tenzing. Base cases: Check for game termination conditions when a player runs out of monsters. Return “Tsondu” if Tsondu wins, “Tenzing” if Tenzing wins, and “Draw” if the game ends in a draw.

Problem B. Tenzing and Books

To solve thes problem: First read the input for the number of test cases, Tenzing’s favorite number ‘x’, and the difficulty ratings for each stack of books. For each test case: Iterate through all possible combinations of books in the stacks.Use a nested loop to perform a bitwise OR operation, updating Tenzing’s knowledge while reading books. Check if Tenzing’s knowledge reaches ‘x’ during this process. Output “Yes” if ‘x’ can be reached; otherwise, output “No” if ‘x’ is unattainable.

Problem C. Tenzing and Balls

To solve this problem: First read the number of test cases, the count of balls, and their colors for each test case. For each case: Traverse the array of ball colors. Store the last occurrence index of each color. Calculate the number of removable balls between each occurrence of the same color. Keep track of the maximum number of removable balls encountered. Output the maximum number of balls that Tenzing can remove for each test case.

Problem D. Tenzing and His Animal Friends

To solve this problem: Parse the number of animal friends and special restrictions. If there are no restrictions, output “inf” as Tenzing can play indefinitely. Apply dynamic programming using a bitmask approach: Create a DP array to track the maximum time for each subset of animals, considering the given restrictions. Update DP values considering the constraints and times for each subset of animals. Retrieve the maximum time Tenzing can spend playing with his animal friends.

Problem E. Tenzing and Triangle

To solve this problem: Read the number of points, the line equation x+y=k, the coefficients A, and the coordinates of the points with their respective erasing costs. Sort the points based on their sum of coordinates x + y. Use a priority queue or min-heap to track the cost needed to erase each point. Traverse the sorted points: Calculate the cost for potentially drawing a triangle to cover each point. Compare the cost of drawing a triangle versus directly erasing the current point and choose the minimum cost. Output the minimum cost needed to erase all points under the line x+y=k while considering the constraints.

Conclusion:

In the end, I was able to solve A, B, C, D, D,E problems. For me problem last problems warre difficult. I wasted a lot of time to solving these problems, but I was not able to solve these problem. All the best for the upcoming contest.
Thank You !!!


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads