### PrinceOfPersia's blog

By PrinceOfPersia, 7 years ago,

Hello everyone.

Soon, On the night after the Halloween, there will be a Codeforces gym contest, named Crypto cup 1.0.

Like its name, it's a cryptography contest and for all problems, you are given some sample encryptions encrypted using a certain algorithm and you have to write a program to decrypt the given messages.

There will be 18 problems and you have 6:30 hours to solve them. I hope it will be interesting.

Problems are prepared by me (PrinceOfPersia) and tested by Damon also thanks HosseinYousefi for editing problem statements.

For practicing cryptography, we recommend SecutiryOverRide's cryptography challenges.

Also, this round needs a little Algorithm and CS knowledge.Don't forget to pay attention to problem's titles, they might be helpful ;)

Currently, problems are being prepared, so you're unable to see the contest in gym contest list yet.

Problems are in decreasing order of difficulty.

UPD: Duration has been increased by half an hour, now it's 6:30 .

UPD2: Please note that contest will be held on November 1st, because it had overlap with Shahid Beheshti University ACM.

UPD3: Now it's in the Gym contests list.

UPD4: Registration is open.

UPD5: Contest is over.

I hope you enjoyed the problems.

Congratulation to the winners who solved all the problems :

Complete standing

Be aware, our standard rounds are coming... ;)

Announcement of Crypto Cup 1.0

• +132

 » 7 years ago, # |   0 Cool, crypto CTF at CF =)
•  » » 7 years ago, # ^ |   +8 Four 'C'-begin-words. Amazing!
 » 7 years ago, # |   0 how to patipate,can it held on webstie
•  » » 7 years ago, # ^ |   0 gym
 » 7 years ago, # |   0 I hope it will be a rated event for both divisions. :D Finally I will get to code Caesar cypher(Rot13) and other cool algorithms like transposition, substitution(Monoalphabetic && Polyalphabetic) in reverse(decryption). m = D{key}(m')
•  » » 7 years ago, # ^ |   0 It's a gym contest.None of gym contests are rated.
•  » » » 7 years ago, # ^ | ← Rev. 2 →   0 Didn't know that before. Thanks.
 » 7 years ago, # |   -11 what are the stars near contests in gym?
•  » » 7 years ago, # ^ |   +4 Difficulty level.
 » 7 years ago, # |   +27 CS knowledge like Counter Strike knowledge ? :D
 » 7 years ago, # |   +11 well this will be an interesting way to get rid of my boredom(since there is a lot of time before the new contest)
 » 7 years ago, # |   0 the interesting picture :>I hope the questions will be interesting too!! :)
 » 7 years ago, # |   0 nice,and could you put the Shahid Beheshti University ACM into the gyms too,thanks
 » 7 years ago, # |   0 im searching for a team is there any?
 » 7 years ago, # |   -11 Happy Halloween :)
 » 7 years ago, # |   0 very nice problem I love them !:)
 » 7 years ago, # |   -35 ridam 2 in c0nteste2n baw....... hadeAghal nmiriDd b Sme reza...... tnks :x
•  » » 7 years ago, # ^ |   0 please write in English you are very Rude .....!
 » 7 years ago, # |   +5 it was really good but the time of contest was so a lot and i resigned from coding after 2 hours
 » 7 years ago, # |   0 Some violet colored participant like to ask: can you give me code of N or B please ? here is code of H ;) : ...
•  » » 7 years ago, # ^ |   0 The same :D
 » 7 years ago, # |   +15 I_love_Hoang_Yen, kennethsnow and 135678942570 are first to get the full-score. Congratulations!
 » 7 years ago, # |   +3 What is the solution of 7th test case in task G?
•  » » 7 years ago, # ^ |   +8 zombiesaredangerous
•  » » » 7 years ago, # ^ |   +5 In G, I used online anagram solver for test 5, 6, 7. Was that intended method?
•  » » » » 7 years ago, # ^ |   0 Brute force + Creativity + Do a little smart was the intended method :-)
•  » » » 7 years ago, # ^ |   +3 And what was the answer to test case 6?
•  » » » » 7 years ago, # ^ |   +3 justalittleshuffle
•  » » » » » 7 years ago, # ^ |   0 what was the answer to test case 5?
•  » » » » » » 7 years ago, # ^ |   0 thevampirediaries
 » 7 years ago, # |   +16 Problem G case 7, "use some bazinga order" we (non-native speaker) just guess it is an amazing answer. :-)
 » 7 years ago, # |   0 can somebody tell, how to solve N?
•  » » 7 years ago, # ^ | ← Rev. 5 →   +13 ** spoiler alert **If you really want to see solution, click on Rev until you see it.
•  » » » 7 years ago, # ^ |   0 Thanks, I observed it for 1 hour and didn't find it:( Then I left this contest.
•  » » » 7 years ago, # ^ |   +1 I don’t understand how you can just guess the 12 unknown patterns.
•  » » » » 7 years ago, # ^ | ← Rev. 2 →   0 Spoiler (See Revisions)
•  » » » » » 7 years ago, # ^ | ← Rev. 2 →   0 Sorry, I don’t see what you’re talking about. You’re just reciting the input data and saying “look, there’s a pattern”, which is not very helpful. There certainly is a pattern (as I describe in my answer), but you don’t even attempt to explain what it is. As for this particular thread, my very point is that finding a pattern is, you know, a bit different from guessing.
•  » » » » » » 7 years ago, # ^ |   0 In this contest you sometimes just had to use your intuition and make educated guesses. Also see other tasks like L or G. Most of the sequence here was known and a good guess for the pattern was +1 +7 +1 +7 +1 ...
•  » » 7 years ago, # ^ |   +3 spoiller alertfrom test cases, you can see a pattern going on. for instance, 0 is a, 8 is c, 16 is e, 17 is f, 25 is 5, 4 is i... and so on.
•  » » 7 years ago, # ^ | ← Rev. 6 →   +5 Permute the bits in each number and treat it as an alphabet index.The first thing to notice is that the numbers are all smaller than 32 and that the task description guarantees that they all correspond to letters. It seems that the numbers are (in some way transformed) alphabet indices.At this point, we can compare some encoded and decoded indices. We can see that that ‘a’ is zero both encoded and decoded if you take alphabet indices to start at zero (which we can now try to assume), and in other indices bits seem to move around. We should also take a look at the problem name: it seems like it has the first letter in the middle… in fact, it seems like all the letters are shuffled.Together, this leads to the guess that perhaps the encryption just permutes the bits in the binary representation of the index. This permutation can be reconstructed from the sample data; a quick way is to start with the indices that have only a single bit set, namely, 4, 8 and 16 (because we can immediately see where the permutation moves that bit). We do indeed get a single permutation that holds for all of the sample data, and so the problem is solved.The problem name is a shuffled “Permutation”.
•  » » » 7 years ago, # ^ |   0 used wordlist and regexp[letters]{10}to guess the word :D
 » 7 years ago, # |   +28 In G, when I saw "lbciutrps", I immediately know that it is "strip club".. If my girlfriend knows, she would be mad ~~
•  » » 7 years ago, # ^ |   0 I wonder why you immediately know it. Is it your favourite word? Does this word always appear in your mind? :P
 » 7 years ago, # |   0 What is test case #4 in problem H ? (Can't find mistake in my code/logic).
 » 7 years ago, # | ← Rev. 2 →   +8 Testcase #4 for H was weird: My Python program failed when it assumed the input to be formatted exactly as specified. Only after I modified the read function to ignore whitespace did it pass. I saw that other people had the same problem (runtime error on test 4) and I asked a clarifying question, but no reaction from the judges. I feel like that testcase should have been fixed and the solutions rejudged...
•  » » 7 years ago, # ^ | ← Rev. 2 →   0 My Perl program reads exactly formatted input too. Now, after I stripped lines from spaces + ignored empty lines, my code got AC too.
•  » » 7 years ago, # ^ | ← Rev. 2 →   0 Ah, so that was the problem! I rewrote my Python solution in C.Actually, my Python implementation should tolerate whitespace on lines… Were the lines split incorrectly? Edit: right; it seems from your comments that there were empty lines.
 » 7 years ago, # |   0 Thank you for the problems.I see that some participants (including me) have problems with H's test 4. What is that specific about it?
•  » » 7 years ago, # ^ |   0 It's completely random :D
•  » » » 7 years ago, # ^ | ← Rev. 2 →   0 Can't you agree that test #4 is incorrect? — has excessive input which is not defined in the section "input"? Empty lines they are. Can't you agree that there exist some test cases which has a statement's logic collision? If take first line of input twenty six zeroes, then 1) if follow "input" section — there must follow zero lines, 2) if follow upper statement — then there must follow more than zero lines. If contestant strictly follows what is written in "input" section, he knows how much lines must input include, and he can read all lines till the end of input file. If there are excessive — non declared lines — it's obvious that they can affect result of program. Others, who read not all lines of input, for example if they count from the first input line how much lines should follow, then use only them, but not use lines which follows later and which are not declared.
 » 7 years ago, # |   +5 How to solve M?
•  » » 7 years ago, # ^ | ← Rev. 3 →   +5 Letters with odd ASCII -> 191 - theirnumberinalphabet Letters with even ASCII -> 189 - theirnumberinalphabet
•  » » 7 years ago, # ^ | ← Rev. 3 →   0 Spoiler on revisions and code on ideone (http://ideone.com/G14Imp)
•  » » 7 years ago, # ^ | ← Rev. 7 →   +11 XOR each byte with 222.One of the common symbols used to denote XOR in mathematics is the circled plus , which is hinted at in the problem name. (In fact, the TeX code for is literally \oplus.) The value 222 is easily determined from the sample data.In many programming languages including C, C++, C#, D, Java, Python, Ruby, Perl, PHP and JavaScript, XOR is performed by the ^ operator. Some others, such as Pascal and Haskell, provide an xor keyword or function.
 » 7 years ago, # | ← Rev. 3 →   0 Is any editorial-like thing available?
 » 7 years ago, # |   +2 Interseting contest indeed. Without teammates,after solving 11 problems,I got stuck and went to bed(so sad) Will there be official/unofficial Editorial for this contest?
 » 7 years ago, # |   +2 why we can't see others code for the problems that we didn't solve? ...i want to learn something new..
 » 7 years ago, # |   +1 Funny contest!Will there be Crypto Cup 2.0 in the future?
•  » » 7 years ago, # ^ |   +23 Sure !
•  » » » 7 years ago, # ^ |   -11 next Halloween?!
•  » » » » 7 years ago, # ^ |   +8 Maybe !
 » 7 years ago, # |   0 theme of the contest — search (binary? ternary? Web!)
 » 7 years ago, # |   0 Can someone provide some hint on how to use the tree from task P to decode? I can construct the tree from the Prufer sequence but not finding how to use that information to transpose the string.
•  » » 7 years ago, # ^ | ← Rev. 7 →   +5 Root the tree (root is vertex 1), then sort the adjacency list of each vertex in increasing order.Then assign a character to each vertex of the tree, one by one using DFS (by starting time), ci is the character assigned to vertex i (Find the DFS order of the tree and call it b1, b2, ..., bn, so cbi = si). Then find BFS order of the tree (first all vertexes of first level, the second level,...), it is p1, p2, ..., pn. Answer is : cp1cp2...cpn .
•  » » » 7 years ago, # ^ |   0 Thanks. I just need to figure out where my solution is being too slow now.
 » 7 years ago, # |   0 Finally your standard round is coming!