11024 - Circular Lock
Moderator: Board moderators
11024 - Circular Lock
I got WA during the contest...
I think that a lock can be deactivated if and only if
(p11-s11)%p11 + (p22-s22)%p22 = (p12-s12)%p12 + (p21-s21)%p21
am I right?
If not, what's the correct way to solve this problem?
Thank you very much!!
I think that a lock can be deactivated if and only if
(p11-s11)%p11 + (p22-s22)%p22 = (p12-s12)%p12 + (p21-s21)%p21
am I right?
If not, what's the correct way to solve this problem?
Thank you very much!!
In the contest I did a silly mistake and got WA. But now I fixed my code and get it Accepted.
Suppose S11 is unchanged, and x press(es) to S12, S22 and y press(es) to S21,S22.
Then there would be a solution if
S11 % P = (S12 + x) % P = (S21 + y) % P = (S22 + x + y) % P
Now the rest is yours.
Hope it helps.
Suppose S11 is unchanged, and x press(es) to S12, S22 and y press(es) to S21,S22.
Then there would be a solution if
S11 % P = (S12 + x) % P = (S21 + y) % P = (S22 + x + y) % P
Now the rest is yours.

Hope it helps.
Ami ekhono shopno dekhi...
HomePage
HomePage
-
- Guru
- Posts: 584
- Joined: Thu Jun 19, 2003 3:48 am
- Location: Sanok, Poland
- Contact:
-
- Experienced poster
- Posts: 106
- Joined: Thu Jan 29, 2004 12:07 pm
- Location: Bangladesh
- Contact: