Skip to main content
  1. Editorial/

Codeforces Round 962 Discussion stream (with hints)

·210 words·1 min
aryanc403
Author
aryanc403
Asia West Champion, ICPC World Finals 2021 | CodeChef Snackdown, World Finalist 2021
Table of Contents

A. Legs
#

Hint

Greedily take Cow as long as you can.

Video Editorial

B. Scale
#

Idea

Just print all index $A[i \cdot K][j \cdot K]$

Video Editorial

C. Sort
#

Hint

Prefix Sum

Video Editorial

D. Fun
#

Hint 1

Bruteforce works, now analyse why it works.

Hint 2

Sum of Harmonic series

Video Editorial

E. Decode
#

Easy version

Count no of substrings with equal 0s and 1s

Hint 1

Replace all 0 with -1. Now all segments with equal 0 and 1 have zero sum.

Hint 2

Instead of counting segments inside each range. For each substring with zero sum, count segments it is a part of.

Video Editorial

F. Bomb
#

Hint 1

Greedy, always take the index with maximum value of $A-i$

Hint 2

Binary search FTW

Hint 3

Binary search on the value you will add in $k^{th}$ operation.

Video Editorial

G. Penacony
#

Hint 1

Delete one road, now path between any pair of friends is unique. Try to count paths which do not lie between any pair of friends.

Hint 2

Given an array A, and multiple queries $L_i$ and $R_i$. Can you find the minimum value in this range, and how many times it appears?

Video Editorial
Daily Chat QnA