Nickolas's blog

By Nickolas, 4 years ago, In English

1505A - Is it rated - 2

This problem described the task in quite a lot of detail. The main challenge was that it was interactive, so some effort was required to figure out the right sequence of reading from standard input, writing the answer and checking for end of file. Here is the code in Python:

while True:
    try:
        q = input()
    except EOFError:
        break
    print("no", flush=True)

1505B - DMCA

As the problem statement strongly hinted, in this problem you had to calculate the digital root of the given number.

The digital root of a given number is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached.

1505C - Fibonacci Words

YES or NO answer implies that you need to figure out whether the given word is a Fibonacci word. Similarly to the Fibonacci-style integer sequences, a Fibonacci word is a word for which each letter equals the sum of two previous ones. Unlike the integer sequences, for this definition to make sense we have to convert each letter to a number between 0 and 25, and perform addition modulo 26.

1505D - Xenolith? Hippodrome?

Again, YES or NO answer implies that you need to figure out whether the given pair of numbers describes something called something like "hippodrome"... Or was it "xenolith" after all? Neither of these options makes a lot of sense, but you know how it is when you're trying to remember a fancy-sounding word and come up with all kinds of similar-looking ones? The word you're looking for here is "xenodrome" — a number which, when written in a certain base, has no duplicate digits. This explains a lot: the given numbers $$$N$$$ and $$$M$$$ are the candidate number and the base, respectively; the task is to write $$$N$$$ in base $$$M$$$ and check whether all digits are unique.

1505E - Cakewalk

As the flavor text hinted and examples 3 and 4 confirmed, the mouse doesn't use an optimal strategy, but rather follows a greedy algorithm: it always goes for the nearest berry square, where the distance between squares is defined by Manhattan distance (i.e., the number of steps to the right or down that the mouse needs to take to get between them). In case of a tie, it goes for the square in the top row.

1505F - Math

The images given encode a formula $$$2-x^2$$$ using Braille for math; the top image (the shorter one) gives Nemeth representation, and the bottom one — Universal English Braille.

1505G - Encoded message

The biggest hint for this problem is that it follows 1505F - Math. Once you spent some time staring at Braille symbols, recognizing the pattern of 5 numbers becomes easier: the first three numbers and the last two are the numbers of dots in the rows and columns of the Braille symbol for the encoded letter, respectively. Typing in those numbers in the solution required a fair amount of focus, but I did it at 2 am and got them right on the first try, so I figured out it's realistic :-)

1505H - L BREAK into program

The given program is a ZX Spectrum emulator memory snapshot.

Here are the possible steps to solve the problem:

  1. Load the file into a ZX Spectrum emulator (there are many versions, even online ones).

  2. Press BREAK (usually Shift+Space in the emulator).

  3. Press LIST (k) to see the BASIC source code.

  4. Notice that the actual program ("Admin zone") starts on line 1000.

  5. Execute "RUN 1000" and get "Integer out of range" error.

  6. Find a bug in the line 1150 and fix it by changing "-" to "+", then re-run.

Line 1140 has a hidden comment about the bug. To see the comment, the background needs to be changed to a color different from white, by executing "PAPER 4", for example. It's also possible to see the comment by looking at the snapshot file in a text editor.

Instead of fixing the BASIC program, it's also should be not too hard to understand the logic and re-implement it in a more conventional programming language.

1505I - Mysterious language again, seriously?

Unlike the past years, this time any code you submit in ``Secret 2021'' language will run successfully — or at least produce no recognizable error. The key hint at the solution can be found in the title: turns out Seriously is a programming language!

The next part of the challenge is figuring out how to print a message in this language — since most characters are valid commands, there's a lot of documentation to go through! There are multiple ways to print the right message (a lot of them undocumented). The reference solution used commands '1'-'9' to put corresponding numbers on the stack, '+' and '*' to perform addition and multiplication on the stack elements to get the necessary ASCII codes on the stack, 'c' to convert the integer ASCII code into the corresponding character, and '◙' to print the character on top of the stack.

  • Vote: I like it
  • +140
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Awesome just after contest, medicine for my pain ;)

»
4 years ago, # |
  Vote: I like it -8 Vote: I do not like it

Thanks for the fast editorial. I desperately needed to see the solutions of B and E.

»
4 years ago, # |
  Vote: I like it +54 Vote: I do not like it

So what the hell is "xenodrome", googled it and found nothing

»
4 years ago, # |
  Vote: I like it +40 Vote: I do not like it

I like my solution in I more: [36]Σ[80148078967894]Σ¡ÿ. It uses fancy "convert to base representation" and "title" operators. Also it uses a shorter way to push a number onto stack :)

Also, was using quotes and/or escape-backslashes the unintended feature?

»
4 years ago, # |
  Vote: I like it +24 Vote: I do not like it

For Problem F, I learned a lot from https://nemeth.aphtech.org/

»
4 years ago, # |
  Vote: I like it +39 Vote: I do not like it

I think this tc should be added in E
4 4
...*
...*
*...
....
The correct output should be 1 according to the editorial , but some solutions (including tourist) is giving ans as 2

»
4 years ago, # |
  Vote: I like it +158 Vote: I do not like it

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    So the April Fools round is also kind of an educational round...

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    There is one more step somewhere between 3 and 4: Braille is very commonly used in escape rooms, puzzle hunts, etc. — that's how I'm learning it :-)

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

im excited Nicolette is an admin of tc alchemy progopedia

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there a problem in my code that I don't see?

x = str(input())
y = 0
for i in x:
y += int(i)
print(y)

For some reason it fails on test 4 of DMCA.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You need to put only single digit answer
    for example at 3689
    3+6+8+9 = 26
    now you need to do :
    2+6 = 8
    Therefore 8 is the answer and not 26.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +1 Vote: I do not like it

      I'm such a dumbass.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it +8 Vote: I do not like it

        lol Even I didnot notice it during contest. I dont even know how DMCA is related to Digital Sum!

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it +9 Vote: I do not like it

          Digital [millenium] Calculation [act]. And you're asked about a root in the statement. Add the two words together, digital root.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It gives 18 for 99. 9 is the correct answer.

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

For problem F, after around 20 mins of head scratching, this website saved me :)

»
4 years ago, # |
  Vote: I like it +6 Vote: I do not like it

To be honest I didn't like the problem set. I don't know how everyone other than me is liking it much. Expected better problems to make everyone fool! :"3

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Yeah, not enough data structure problems, they were all ad-hoc

»
4 years ago, # |
Rev. 2   Vote: I like it +52 Vote: I do not like it

Here's a (somewhat) simpler solution to H. Open the file as binary. It's mostly unreadable, but there's some clearly visible text like n=11, a(n), b(n), TODO Change - to + and c=a(i)-b(i). There are also some two-digit numbers with commas nearby. If you remove all non-printable characters, you get 44,12,49,17,10,25,18,17,24,25,20 and 55,99,61,99,91,90,98,30,25,30,29, which you suppose to be the arrays a and b, especially given that they both contain 11 numbers. After that just calculate the sum and get the answer.

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Here's something that was done wrong in this round: the title of I shouldn't have been translated to Russian, like you did with problem D. The language is named 'seriously', not 'серьезно'.

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Even xenodrome is NOT fancy-sounding word :(

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I couldn't find anything online for Z80. "Z80 emulator" only gave me some garbage results and I am impressed by googling skills of people that were able to find anything helpful that way. And even if I succeeded in that I would need to execute some completely random commands there I see (these BREAK, LIST, RUN, wtf?). What I did was just to stare at the text dump and figuring out what it does was pretty easy from that.

  • »
    »
    4 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Googling the problem name is more useful than "Z80 emulator".

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Z80 is a processor, it's as if you googled 'x86 emulator'. You were actually looking for a ZX Spectrum emulator. BREAK is not a command but a key. LIST and RUN are some standard BASIC commands, almost every BASIC dialect has them.

    Doesn't make the problem any better though.

»
4 years ago, # |
  Vote: I like it +11 Vote: I do not like it

did anyone feel the answer for I is Whitespace Language XD ?? Completely went down that rabbit hole and I feel like I am the biggest April fool.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hey, same here. But then I tried 123 just to make sure and boom, no, not whitespace. I spent the following 60 minutes checking some commands like + and * to check if it's a stack-based language, H and Q for hello world and quine to check if it's a code golfing language, etc. I didn't expect it to be some random esolang we're supposed to guess from English problem title (Russian translation made it much harder to figure out 'Seriously' is a name, not a word).

»
4 years ago, # |
  Vote: I like it +15 Vote: I do not like it

What was the 'undocumented language feature' in I that you disabled, by the way?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it -10 Vote: I do not like it

    "Seriously" just printing the message... I was happy with pretty much any other way to output the message (people who solved this problem all used different approaches, neither of them using mine), but this one takes it a bit too far even for the April Fools Day Contest — and " is not supposed to do any printing :-)

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it +36 Vote: I do not like it

      "Seriously" is a completely valid solution. "Seriously" on itself pushes the string onto stack. When the program ends, the stack is printed to the terminal. As there's only one string in the stack, it gets printed.

      What part of that is undocumented?

»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

What was wrong with this solution if you guys don't mind, Prob B: https://codeforces.me/contest/1505/submission/111717549 Edit: Didn't run my code on my machine for this contest. It's buggy

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    You don't need i *= 10. You also need to wrap the code in a while(num > 9) loop.

    But a much better solution is to print (n - 1) % 9 + 1.

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

why -> i did not use fflush in my code for interaction problem and i got ac link->https://codeforces.me/contest/1505/submission/111731883

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hi, can you enable uphacking?

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In A, printing "NO" a large number of times seems to work. (without taking any input)