Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

mohitagr0001's blog

By mohitagr0001, history, 5 weeks ago, ,

A — Elephant

We answer will be n/5 if n%5==0 and if it's not 0 means remainder can be 1,2,3,4 which can be done in 1 step so, the output will be n/5+1.

Solution Problem A

B — Summer Camp

This one is a simple brute force problem, we will construct our string with numbers. After construction, we just have to print the n-th element of the string.

Solution Problem B

C — Bear and Five Cards

You need sort the array and find the max of 2 occurrences and max of 3 occurrences from the array, then subtract the maximum with the total sum to get the minimum sum.

Solution Problem C

D — Opponents

You simply need to check if any row has 0 in it and find the largest consecutive such row.

Solution Problem D

E — Pineapple Incident

You should check two cases for YES:

1.x mod s = t mod s and t ≤ x
2.x mod s = (t + 1) mod s and t + 1 < x

Solution Problem E

F — Collecting Packages

It is obvious that if there is a pair of points (xi,yi) and (xj,yj) such that xiyj then the answer is "NO". It means that if the answer is "YES" then there is some ordering of points such that xi1 ≤ xi2 ≤ ... ≤ xin and yi1 ≤ yi2 ≤ ... ≤ yin because we can only move right or up. But what is this ordering? it is just sorted order of points (firstly by xi then by yi).

So we can sort all points, check if this ordering is valid and traverse among all these points. For each k from 2 to n firstly do xik − xik − 1 moves to the right then do yik − yik − 1 moves to the up (because this order minimizing the answer lexicographically). Time complexity: O(nlogn) or O(n^2).

Solution Problem F

KeepCoding

Tutorial of PB Hustle 0.1

• +3

 » 5 weeks ago, # | ← Rev. 3 →   +8 Hi, when I clicked on the problem link, I got the pop-up message: "You are not allowed to view the contest". Maybe u made a mistake with the links?
•  » » 5 weeks ago, # ^ | ← Rev. 2 →   0 I am sorry but this was for a contest I organized at my college, so it's visible to only the participants
•  » » » 5 weeks ago, # ^ |   +9 So publish the blog somewhere where only the participants can see.