COMPFEST 15 - Preliminary Online Mirror (Unrated, ICPC Rules, Teams Preferred) G. Grouped Carriages
10034. Count the Number of Powerful Integers
You are given three integers
start,finish, andlimit. You are also given a 0-indexed stringsrepresenting a positive integer.A positive integer
xis called powerful if it ends withs(in other words,sis a suffix ofx) and each digit inxis at mostlimit.Return the total number of powerful integers in the range
[start..finish].A string
xis a suffix of a stringyif and only ifxis a substring ofythat starts from some index (including0) inyand extends to the indexy.length - 1. For example,25is a suffix of5125whereas512is not.
10032. Minimum Number of Operations to Make Array XOR Equal to K
You are given two positive integers
xandy.In one operation, you can do one of the four following operations:
- Divide
xby11ifxis a multiple of11.- Divide
xby5ifxis a multiple of5.- Decrement
xby1.- Increment
xby1.Return the minimum number of operations required to make
xandyequal.
10033. Minimum Number of Operations to Make X and Y Equal
You are given a 0-indexed integer array
numsand a positive integerk.You can apply the following operation on the array any number of times:
- Choose any element of the array and flip a bit in its binary representation. Flipping a bit means changing a
0to1or vice versa.Return the minimum number of operations required to make the bitwise
XORof all elements of the final array equal tok.Note that you can flip leading zero bits in the binary representation of elements. For example, for the number
(101)2you can flip the fourth bit and obtain(1101)2.
10031. Smallest Missing Integer Greater Than Sequential Prefix Sum
You are given a 0-indexed array of integers
nums.A prefix
nums[0..i]is sequential if, for all1 <= j <= i,nums[j] = nums[j - 1] + 1. In particular, the prefix consisting only ofnums[0]is sequential.Return the smallest integer
xmissing fromnumssuch thatxis greater than or equal to the sum of the longest sequential prefix.