Hello codeforces
I liked solving today's contest(on pen and paper :p) and I am sharing the solutions for problems A to D. hope this might help some of you :)
quick editorial for problems A to D
problem A
given n and b. find a such that a + b is maximum possible.
b = B[0] B[1] .... B[n-1]
a = A[0] A[1] .... A[n-1]
sum[i] = A[i] + B[i]
observations:
since we want sum to be as large as possible we want:
1. sum[0] to be as large as possible(hopefully 2 otherwise 1)
2. an integer with more digits is large, so we would like to retain all digits.
to retain all digits make sure sum[i] != sum[i-1]
go for a brute force to determine a.
find A[0] with no constraint. then find A[i] such that A[i] is not equal to A[i-1] and A[i] is as large as possible(2 > 1 > 0).
adding B to D.