This could have been my first ever successful submission to 500 and 1000, although I did not take the competition for other work. Anyway this round seems easier than most div1 SRM. Here are my solution:
250: sort and add a[0], a[n-1], then a[1], a[n-2], and keep track of min and max.
500: try all 2^15 possible moves for rows, then you have a fixed choice for col moves.
1000: two strings would match if and only if break them down to pairs of letters, a[0] with a[1], and a[2] with a[3], ... and the pairs match (either a[2*i] to b[2*j] and a[2*i+1] to b[2*j+1], or a[2*i] to b[2*j+1] and a[2*i+1] to b[2*j])
And you only need to find one word, then iterate through the rest to find a match, cross both. Repeat until no more word can be matched.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment