11312 - Flipping Frustration
Moderator: Board moderators
11312 - Flipping Frustration
I got that this problem is solved using diophant's method. In case the given test case has a solution and after we get a general solution for x (number of left flips) and y (number of right flips), how shall we get the minimum one?
Re: 11312 - FLIPPING FRUSTRATION
It is trivial and similar with problem 10090.I suggest you solve it firstly.Tomato wrote:I got that this problem is solved using diophant's method. In case the given test case has a solution and after we get a general solution for x (number of left flips) and y (number of right flips), how shall we get the minimum one?
1)x<0 && y>0,you can get the maximum x<=0 by add some multiple to x.
2)x>0 && y<0,you can get the maximum x<=0 by sub some multiple to x.
The hardest part of this problem is how to fit the tricky boundary.
Hope it helps.
I tried the following:
Input:
Output:
Seems correct to me. Are they wrong? Can anyone give me tricky I/O? Please help.
Thanks.
Input:
Code: Select all
9
10 5 4 1
1000 2 1 42
100 2 4 66
101 60 70 51
100 2 3 98
10000000 1 1 10000000
35 3 10 35
35 3 10 34
29 13 5 29
Code: Select all
0
41
uh-oh!
uh-oh!
34
9999999
6
15
uh-oh!
Thanks.

I see, i have more than 20 WA.... and i still cant realize an efficient way to know if my numbers will not exceed the number of pages of the book, i mean, i have the minimum x and y ( the minimum sum ) , such that doing x left flip's and y right flips, i can arrive to the page i need, but i dont know if those flips, are feasible with the number of pages of the book. Any hints?? thanks!, Eric.pineapple wrote:"The hardest part of this problem is how to fit the tricky boundary. "