Open In App

Contest Experiences | AtCoder: Beginner Contest 285

Last Updated : 13 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

This contest was conducted by AtCoder’s Platform on the 15th of January 2023, It consisted of 7 questions and the time given is 100 minutes and each question has different points according to their difficulty level.

Link of the contest: https://atcoder.jp/contests/abc285

OVERVIEW OF QUESTIONS:

Problem Name

Difficulty

Points

Edge Checker 2

Easy

100

Longest uncommon Prefix

Easy

200

abc285_brutmhyhiizp

Medium

300

Change usernames

Medium

400

Work or Rest

Medium

500

Substring of Sorted String

Easy

500

Tatami

Hard

600

My Approach:

1st problem:

They give us a complete binary tree with nodes numbered from 1 to 15 from root to leaf as there are only 14 possible pairs we can give conditions directly to check whether this pair is directly connected or not.

2nd problem:

They give a string ‘S’ of length ‘N’, then we had to find the maximum non-negative integer l that satisfies the following condition:

  • l+i <= N where i range is [1, N-1]
  • for all integers k such that 1<= k<=l, it holds S[k] != S[k+i]

My approach is to take two for loops, in the inner loop I gave an if condition to check whether the two indexed characters are equal or not, if not equal increase the count value and printed count value for each inner loop.

3rd problem:

They give a string ‘S‘ and we have to find the index of that string. The order is in the format of A, B.. Z, AA, AB,.. ZZ, AAA… My approach to find the index of given string:
first there are 26^k IDs of length k initialize the answer with 26^1 + 26^2 + 26^3… + 26^(k-1) and then add the value of last letter and add 1 to final answer because we have to print 1-based index.

4th problem:

For the problem of changing usernames based on certain rules with a pair of ‘N‘ strings Si and Ti, where each user wants to change their Si username to Ti:

  • Establish a dependency graph to determine priorities in changing usernames.
  • Identify dependencies by using Depth-First Search (DFS) to traverse the graph.
  • Draw edges from S[i] to T[i] to represent dependencies.
  • If there’s a cycle in the dependency graph, print “No” as changing the usernames would violate the rules.
  • If there’s no cycle, print “Yes,” indicating that it’s possible to change the usernames without violating the rules.

5th problem:

For the problem of finding maximum weekly productivity given a sequence of integers with constraints:

  • You’re given an integer ‘N‘ and ‘N‘ integers representing daily productivity.
  • Declare whether each day is a holiday or a weekday.
  • Ensure there’s at least one holiday in a week (a week consists of ‘N‘ days).
  • If it’s a holiday, the production for that day is 0.
  • If it’s a weekday, calculate productivity as the minimum between the productivities of a day ‘x‘ days before the current weekday and a day ‘y‘ days after the current weekday.

Here’s the approach:

  • Utilize dynamic programming to maximize productivity.
  • Calculate prefix sums to facilitate subarray calculations.
  • Compute values for different segment lengths within the week.
  • Iteratively update to find the maximum productivity.

6th problem:

They give an integer ‘N‘ and a string ‘S‘ and ‘Q‘ queries and each query consists 3 elements t, l, k. if t is 1 then l is an integer and k is a character, we have to change the character at lth index to ‘k‘. if t is 2 we have to check substring from l to k is in sorted order or not.

7th problem:

They give a matrix consisting of 2’s, 1’s and ‘?’ and there are two types of tiles 1×2 tiles and 1×1 tiles. We have to fit these tiles into matrix, if these matrix can be filled then print “Yes” else “No“. By using recursion we can check but I didn’t do this because of having less time.

Conclusion:

The contest includes a range of problem complexities, making it suitable for diverse skill levels.

  • Beginners are encouraged to start with easier contests like ABC (AtCoder Beginner Contest) before attempting this one.
  • Job seekers targeting placements should be prepared for a higher level of difficulty.
  • This contest offers valuable experience for those aiming to excel in competitive programming.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads