I give 2 hints.
the first hint:
If n is not multiple of k
you can add any the same character after plaintext and cyphertext, like:
k = 5
"abcdabcd"
"bcdabcda"
after add '?'
"abcdabcd??"
"bcdabcda??"
then you can check k = 5
the second hint:
If one string is "abcdeee"
it has possible 3! permutation.
so "abcdeeefghiii"
it has possible 3! * 3! permutation.
when string having 80 characters, the factorial may be very big.
you can set a threshold to limit it (ex. 10000 permutation).
It needn't to check all possible string or u would get TLE.
179 - Code Breaking
Moderator: Board moderators
-
- New poster
- Posts: 32
- Joined: Tue Feb 13, 2007 1:31 pm
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 179 - Code Breaking
Thanks for your hints, I got AC.
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.