Блог пользователя Nickolas

Автор Nickolas, 3 года назад, По-английски

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.

Разбор задач April Fools Day Contest 2021
  • Проголосовать: нравится
  • +140
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Awesome just after contest, medicine for my pain ;)

»
3 года назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +54 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +40 Проголосовать: не нравится

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?

»
3 года назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +39 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +158 Проголосовать: не нравится

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +21 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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 :-)

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

im excited Nicolette is an admin of tc alchemy progopedia

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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.

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      I'm such a dumbass.

      • »
        »
        »
        »
        3 года назад, # ^ |
          Проголосовать: нравится +8 Проголосовать: не нравится

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

        • »
          »
          »
          »
          »
          3 года назад, # ^ |
            Проголосовать: нравится +9 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

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

»
3 года назад, # |
Rev. 2   Проголосовать: нравится +52 Проголосовать: не нравится

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.

»
3 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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 'серьезно'.

»
3 года назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

Even xenodrome is NOT fancy-sounding word :(

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    3 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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.

»
3 года назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

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.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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).

»
3 года назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится -10 Проголосовать: не нравится

    "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 :-)

    • »
      »
      »
      3 года назад, # ^ |
        Проголосовать: нравится +36 Проголосовать: не нравится

      "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?

»
3 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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.

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hi, can you enable uphacking?

»
3 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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