Page 1 of 2

10952 - Pattern Transformations

Posted: Sun Oct 30, 2005 11:21 am
by Tomzy
Could someone clarify sample input for this problem.

. XO . .
. . OX .
. XX . .

. . XO .
. XX . .
. . OX .

You don't have to swap any symbols but the answer for this sample input is 1???
What's wrong with this transformation?

10952 - Pattern Transformations

Posted: Sun Oct 30, 2005 5:02 pm
by Yarin
The sample output is wrong for this problem. It should be 0, 0, -1.
It seems I never ran my solution on the sample input, and didn't see the correct answer by manual inspection... terrible sorry for that!

Posted: Sun Oct 30, 2005 8:27 pm
by Renat
Are the tests for this problem correct? :)

Posted: Sun Oct 30, 2005 11:50 pm
by Yarin
I hope so :) I think a tester (Derek?) was a assigned to the problem to verify my own solution. As I said, the sample input was hand crafter and it seems the solution program was never used on them (stupid I know).

Posted: Mon Oct 31, 2005 8:24 pm
by mf
I, too, think that the test cases might not be correct.
May I ask you to check them once more? I can send you my solution, if you like.

Posted: Tue Nov 01, 2005 1:05 am
by Yarin
There was a bug in my judge solution to this problem, sorry! I've corrected it, and hopefully it will be reflected on the juge in a couple of days.

Again, sorry for wasting your time finding non-existent bugs :(

hmm

Posted: Tue Nov 01, 2005 4:34 pm
by shahriar_manzoor
To remove any other confusion Derek Kisman was suposed to write alternate for this problem but he could not manage time but when I knew it I had already sent the template so I could not mention that it too did not have alternate solution.

Posted: Wed Nov 02, 2005 6:52 am
by gush
has this problem been fixed yet?

Posted: Wed Nov 02, 2005 2:38 pm
by Yarin
Doesn't look like that. I guess it will be rejudged immediately when it's fixed, and since I know there will be at least one who has the correct answer you just have to look for when the accept rate becomes greater than 0.

Posted: Thu Jul 06, 2006 6:26 pm
by shanto86
i also agree with tomzy. can any one please clear us?

Re: 10952 - Pattern Transformations

Posted: Mon Jul 10, 2006 3:29 am
by mf
You probably have an old version of the problem statement. It was fixed, check the new version here: http://acm.uva.es/p/v109/10952.html

Posted: Mon Jul 10, 2006 5:07 am
by shanto86
Hmm... I see! You are right! I had older version!

Now, how to solve it? Can you please give me some hint?

It seems augmenting path might work. But swap is making all the trouble.

My idea is: Augment path with out making swap. if all the chars are matched then ans is 0. if not then start sweep augmenting path. so andwer is: unmatched/2 where unmatched after first augmneting process. if in the second augmenting process there still remains unmatched chars then -1.

But i think this is wrong process. can anyone please put me on the right track?

Thanks in advance.

Posted: Mon Jul 10, 2006 5:37 am
by mf
I've used dynamic programming: a state is a row number and a pair of bitmasks. My program has O(h 4^w) states, does O(2^w) work per each state, so total complexity is O(h 8^w).

However, I've also got accepted with a pure brute force solution.

Posted: Mon Jul 10, 2006 7:11 pm
by shanto86
What is the meaning of 0 and 1 in bitmask? and what do those two bitmask represent?

Posted: Tue Jul 11, 2006 12:41 pm
by mf
Bitmasks tell which cells of the previous row are vacant (so a letter can be moved there from below), and in which cells of the current row a letter from above is to be moved.