Log inSign up
Problems / P52

The longest of eight words (divide and conquer)

500 ptschatqwen3-0.6bCases 16max 120 tokensSet by dongbinna
Added October 11.

Statement

Find the word with the most characters among eight words. The structure is the same as P51. Four look at two each, two merge the results, and one finishes.

One case arrives as eight lines, like this.

coax
bridge
pen
waterfall
sky
orange
lamp
window

The answer the position at the top has to give is waterfall. The prompt you write does not receive these eight lines at once. At a leaf it receives two lines, coax and bridge for instance, and above that it receives the two results the positions below sent up. The same prompt has to work in both places.

If even one position sends up the wrong thing, that is what travels all the way to the top. Grading looks only at the output of the single position at the top.

Input

  • The input arrives as 8 lines.

  • The whole input is between 38 and 54 characters long.

Output

  • On the first line print the longest of the eight words. The prompt you write receives two words at a time.

  • The output is between 9 and 16 characters long.

  • Do not add any other characters.

  • Not a single character may differ from the expected value.

Requirements

  • The input is two lines, one word per line.
  • The output is the longer of the two words.
  • This is chat mode. The prompt is wrapped in a chat template, so the model becomes an assistant. You can write control tokens yourself to build a conversation of several turns.
  • One case is split into eight pieces. Four agents take two pieces each, two merge those results, and one finishes up. The model runs seven times.
  • The same prompt is used at every position. At a leaf it receives the two original pieces, and at a merging position it receives the two results from below. It has to work in both.
  • Grading looks only at the output of the single agent at the top. If something goes wrong in the middle, it spreads straight upward.
  • The output must match the expected value down to the last character. Only leading and trailing whitespace is ignored.
  • There are 16 cases, and 5 of them show the input together with the expected output. The rest show the input only.
  • Model output is accepted up to 120 tokens.
  • Passing 14 or more of the 16 cases solves this.
Read the requirements carefully before solving. Gaming the score through prompt injection or similar tricks can get you sanctioned if caught.

Examples

5 public cases. Judging also uses hidden cases. Passing 14 or more of the 16 cases solves this.

Input
Expected output
coax
bridge
pen
waterfall
sky
orange
lamp
window
waterfall
judge
token
margin
prompt
stone
riverbank
apple
desk
riverbank
model
local
candle
tiger
mountainous
paper
cloud
table
mountainous
green
north
pencil
elephantine
water
music
chair
road
elephantine
street
blue
notebook
cup
incomprehensible
map
door
fan
incomprehensible

Notes

Background that helps with solving. The rules you have to follow are in the input and output specs and the requirements above.

One more blind spot is laid over this. The model does not see characters. It only sees tokens. To measure length you have to make it write the characters out one at a time, but then the output gets long and the input the position above receives gets messy. You have to keep in mind that the shape the level below produces is the input the level above receives.

Prompt

Qwen3 0.6B
Input to preview
This is the exact text that goes into the model (Sample input 1 is used here.)
This problem wraps your text in a chat template, so the exact text can only be shown once the model is loaded. Load Qwen3 0.6B first with the button below.
The same prompt runs at the leaves and at the merge step. Both receive two lines of text.
0 chars
To solve problems you need to log in.