A. Preparing for the Olympiad #
Idea
Assume $b_{n+1}=0$. Monocarp should solve problems on day i only if $a_i>b_{i+1}$. For all such days, find sum of difference.
My submission — 297813673
B. Journey #
Hint 1
Let $d=a+b+c$. Monocarp will travel $d$ km every $3$ days.
Hint 2
So you will need a minimum of $\lceil 3n/d \rceil$ days.
Hint 3
The required no of days is between $\lceil 3n/d \rceil$ and $\lceil 3n/d \rceil + 3$; check all 4 possibilities.
My submission — 297819285
C. Preparing for the Exam #
Hint 1
Result is one of 3 possibilities
- All are 1
- All are 0
- Only one 1 and the rest all are 0
Try to figure out conditions for all these cases.
My submission — 297827655
D. Counting Pairs #
Hint 1
Based on the sum of all array and x,y, first, find the minimum and the maximum possible sum of $a_i+a_j$.
My submission — 297835279
E. Best Price #
Hint 1
There are many ways to solve this problem. The optimal price will always be some ai,bi.
First, use Coordinate Compression to reduce the range of ai and bi.
Hint 2
Now, for each point, using your favourite range sum data structure, you can find how many people will buy at that price and how many of them will leave a -ve review.
My submission — 297848049
F. Joker #
Hint 1
Explicitly maintain range of intervals where joker can exist, based on these ranges find new ranges.
The crux of the problem is at any point, there will be atmax 3 different such intervals.
My submission — 297910184
G. Snakes #
Hint 1
Introduce a new n+1th snake. For each pair of snakes, L and R, find the minimum distance between them.
Hint 2
Now this is a Travelling salesman problem
My submission — 297893223