9

Notes 5: IOI 2007 Aliens [Easy]

 8 months ago
source link: https://codeforces.com/blog/entry/124147
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

By NeoYL, history, 8 hours ago,

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,YN,X,Y. This means that there is an N∗NN∗N grid with cell(X,Y)cell(X,Y) is black.

The pattern is as follows:

pattern

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

N≤2∗109N≤2∗109

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. (XC,YC)(XC,YC)

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK