Notes 5: IOI 2007 Aliens [Easy]

Revision en3, by NeoYL, 2023-12-31 17:55:06

This is my personal note and might be some kind of user editorial/learning material for some people!

This is the fifth episode of this "note" series. I will write notes on problems (normally around 2400-ish problems), that are both interesting and educational. I normally will spend a few hours on each problem so please be patient when reading the blog.

If you want to motivate me to write a continuation (aka note 6), a significant upvote from you would be well appreciated! If I received lots of downvotes (because I'm also spending a lot of time to write this and to learn latex only to express my ideas accurately to you guys), I'm probably not gonna continuing writing these blogs.

Given three integers $$$N,X,Y$$$. This means that there is an $$$N*N$$$ grid with $$$cell (X,Y)$$$ is black.

The pattern is as follows:

pattern

Each $$$#$$$ means that there is a square grid of length $$$M$$$, $$$M$$$ is guaranteed to be odd and $$$M \geq 3$$$.

$$$N \leq 2 * 10^9$$$

Interactive:

Return True if the cell is black

Return False if the cell is white

Find the centre cell of the grid in the pattern. $$$(X_{C}, Y_{C})$$$

Hint 1
Hint 2
Solution

I have an ugly code for this problem, please refer to codes from some other coders like ko_osaga Hope you guys learnt something from the blog.

Tags binary search, powers

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English NeoYL 2024-01-01 10:32:11 56
en6 English NeoYL 2024-01-01 05:36:59 45 Tiny change: 'liens)\n\nGiven ' -> 'liens)\n\nPersonally I think this problem is *2200.\n\nGiven '
en5 English NeoYL 2024-01-01 05:07:05 59
en4 English NeoYL 2023-12-31 18:38:13 3 Tiny change: 'e ko_osaga\nHope you' -> 'e ko_osaga.\n\nHope you'
en3 English NeoYL 2023-12-31 17:55:06 98
en2 English NeoYL 2023-12-31 17:41:19 10
en1 English NeoYL 2023-12-31 17:13:52 2145 Initial revision (published)