Problem

Source: IZhO2023, P1

Tags: combinatorics, cards



Peter has a deck of $1001$ cards, and with a blue pen he has written the numbers $1,2,\ldots,1001$ on the cards (one number on each card). He replaced cards in a circle so that blue numbers were on the bottom side of the card. Then, for each card $C$, he took $500$ consecutive cards following $C$ (clockwise order), and denoted by $f(C)$ the number of blue numbers written on those $500$ cards that are greater than the blue number written on $C$ itself. After all, he wrote this $f(C)$ number on the top side of the card $C$ with a red pen. Prove that Peter's friend Basil, who sees all the red numbers on these cards, can determine the blue number on each card.