spoj ⇒ classical ⇒ andround ⇒ AND Rounds

you can get the problem statement from here.

as we know a&a = a so if we can observe that after k rounds, k elements from left and k elements from right are operated under boolean and operation with the ith element then it is easy to implement the code for it, an implement tweak is to generate three times of the sequence, and generate answer through that if (2*k + 1) < n else and operation on all n elements.

https://gist.github.com/5481f2f90b4204401f85

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s