Open In App

Contest Experiences | Codeforce Round: #880 (Div. 1 & Div. 2)

Last Updated : 01 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

About The Contest:

The Contest was organized on 18 June 2023 on Codeforces. The Contest consisted of 6 problems for Div. 1 and Div. 2 participants and had a duration of 2 hours. The contest had around 25k registrations combining both divisions. The scoring for various questions was as follows:

Question

A

B

C

D

E

F

Div. 1 Score

500

1250

1500

1750

2250

3000

Div. 2 Score

750

1000

1250

2000

2250

2750

Contest Link: https://codeforces.com/contest/1836

My Experience:

Problem Name

Topic

Difficulty

Time Taken

No. of Submissions

Destroyer

Math

Easy

10 min.

1

Astrophysicists

Greedy, Math

Easy Medium

10 min.

1

k-th equality

Math

Medium

15 min.

1

Lottery

Two Pointers, Binary Search

Medium

25 min.

2

Twin clusters

Bit Manipulation, Meet in the middle

Hard

30 min.

2

Doctor’s Brown Hypothesis

Graphs, Math, Number Theory

Hard

Problem A: Destroyer

In this problem, John needs to check if electronic brain of robots is damaged or not after a battle. The test is to order the robots to form one or several lines, in each line the robots should stand one after another. After that, each robot reports the number of robots standing in front of it in its line. We are given the number of robots reported by each robot and we need to check whether such an arrangement of robots is possible such that we can conclude that all robots reported true. Thus, we just need to check if we can divide the input sequence into multiple arithmetic sequences having common difference as 1 and they all start with 0. To check this, we need to check whether occurrence of x is greater than that of x+1 for every x>=0. Thus, we can solve this problem in a linear time complexity.

Problem B: Astrophysicists

In this problem, we had a total of k*g silver coins and we needed to distribute them among n astrophysicists based upon two conditions. If we had to give one, x coins and r = x%g, then if r is greater than or equal to ceil of g/2, he would be given x+(g-r) coins and otherwise he would get (x-r) coins. To maximize company’s profit, we would choose x for each employee such that, it always falls in 2nd condition. This can be done if we choose x to be (g+1)/2-1 for each employee as in this case the profit for company would be as in this case remainder would be x itself and hence we give 0 coins to each employee. But according to question, we need to choose x values such that they sum total to k*g. Thus we can choose x to be (g+1)/2-1 for (n-1) employees. And, the remaining amount would be assigned to one employee and profit to company can be then calculated accordingly.

Problem C: k-th equality

In this problem, we needed to print lexicographically k-th smallest equality of form a+b=c, where a,b and c have A,B and C digits respectively. Values of A, B, C and k were given. If there are less than k equalities for given case, we had to print -1. Constraints were such that the value of a could be at max 106-1, so we could iterate by fixing value of a, and then to the corresponding value of b, we get a value of c, if that value has C digits, then it is a valid equation. In this way we could find the k-th equality and print it. Thus, we got a solution in an almost linear time complexity.

Problem D: Lottery

In this problem, we needed to determine what number should be on Bytek’s lottery ticket to win. The rules were such that a integer would be chosen uniformly from 0 to m and k tickets closest to that integer would win. If there is a tie, the person who had smaller index is the winner. Bytek being the last one to buy ticket has index as n+1. We are given n as number of persons excluding Bytek and their tickets numbers. Also, we are given values of m and k. To solve this problem, we store the frequencies of integers on tickets. And then we can check for each integer value for Bytek and get to know whether in that interval we have k closest tickets. This can be done efficiently using two pointers technique.

Problem E: Twin Clusters

This problem was one of the hard problems of the contest. The hard problems in competitive programming have multiple concepts involved in them. The current problem involved Bit Manipulation, Prefix XOR, and Meet in the Middle concepts. Meet in the Middle is an efficient algorithm that is used in various hard problems of competitive programming, it can be learned from this article on GeeksforGeeks. In this problem, we had to determine if we find two disjoint continuous intervals which have same value of bitwise XOR of elements within that range.

Conclusion:

I participated in the contest as a Div. 2 participant and was able to solve 5 problems out of 6 in the given time. When you start participating in competitive programming contests with some basic knowledge of DSA, it is easy to solve about 2-3 problems in each contest but to solve more problems during the contest, you should upsolve the problems after the contest and learn about the concepts involved in them. And, practice problems related to that topic, so that when related problems appear in the contest, you would be able to solve them.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads