FahimR's blog

By FahimR, history, 6 weeks ago, In English

The SPC Round 66 problemset are here

BCB :

Just keep all the names in a string array and find is the given string available in that array or not

Bosses of an array :

Iterate from last to first and maintain a max_value variable that keeps track the maximum value of the suffix of that array. If current position is equal to the max_value then count it as boss.

Successive Number :

you need to maintain the ratio equal among a:b and b:c. Let's say r = a / b then c = b * r

Calculate from valid expression :

Keep track a parity (initially even). Your current integer may be positive or negative. Let's say positive means even team and negative means odd team. Then if even parity and even team or odd parity and odd team found then the current integer will be added to your answer otherwise it will be subtracted. The parity can be changed if "-(" is found anywhere and also can be changed if ')' is found and it is ending of a "-(" starting. We can use stack to keep track that. Also be careful, a number between two arithmetic sign may not fit in 64 bits. So, keep moding the answer carefully.

An usual function :

Hash the frequency of the array elements. Do sieve, and add contribution to all multiple of current value by current value's frequency. The find the maximum contribution.

All submissions are open in this contest. You can check them from every challenges page. Thank you for attending this round.

  • Vote: I like it
  • -1
  • Vote: I do not like it