arc093_b: Grid Components

We just a grid with 41 rows, and 100 columns

row 0 - 20, fill with #

row 21 - 41, fill with .

for each additional ., iterate to add to (2i, 2j)

for each additional #, iterate to add to (21 + 2i, 21 + 2j)

agc022_b: GCD Sequence

Overall, a hard problem for me!!!

Note that the constraint is equivalent of saying gcd(a(i), S) != 1

Note that we have to pick about 2/3 of all numbers, so we can define S to be multiple of small primes => S = 6K

So we pick 6K + 2 , 6K + 3, 6K + 4, and 6K, and make sure we pick 2, 3 to force all gcds = 1

Note that N <= 5 case is different from N >= 6 case.

arc095_c: Symmetric Grid

Overall a hard problem for me!!!

  1. notice that the order of ops doesn’t matter, so we try all row ops and then col ops

  2. When W is odd, we know (W + 1)/ 2 is a palindrome

  3. Keep track of unused pairs of cols, and see if any of the reversed strings are the same, and populate assignment

  4. However, H! possible row combos are too slow, so we consider only all possible parings of rows 11!! = 11 * 9 * 7 … * 1