DOJ logoDOJ
Problems
Recently added problemsSaved problems
CategoriesDLCContestsGroupsTeamsBoard
Ranking
Solved Problem RankingStreak rankingDOJ Power ranking
Status
Call for TasksLoginRegister
DOJ logoDOJ

Community online judge with OI-style subtask scoring, Elo ratings, and Discord-backed certification.

Problems
ProblemsCategories
Community
ContestsRankingBoardNoticesHost an external contestGuide
Account
LoginRegisterJudge Status
Policy
Terms of ServiceDLC RulesPrivacyAPI documentationLanguage runtimesContest rank rewardsRating and performance
© 2026 DOJ
All rights reserved
Editorial

Permutation of the Year 1

Back to problem

Editorial

We have 2026=452+12026=45^2+12026=452+1. Therefore, for every integer ddd,

d2+(45d)2=2026d2d^2+(45d)^2=2026d^2d2+(45d)2=2026d2

is divisible by 202620262026.

Define

ai=(45(i−1) mod 2026)+1.a_i=(45(i-1)\bmod 2026)+1.ai​=(45(i−1)mod2026)+1.

Since gcd⁡(45,2026)=1\gcd(45,2026)=1gcd(45,2026)=1, the values aia_iai​ for i=1,2,⋯ ,2026i=1,2,\cdots,2026i= are exactly in some order.

For every 1≤i<j≤20261 \leq i < j \leq 20261≤i<j≤2026,

ai−aj≡45(i−j)(mod2026).a_i-a_j \equiv 45(i-j) \pmod{2026}.ai​−aj​≡45(i−

Thus

(i−j)2+(ai−aj)2≡(1+452)(i−j)2≡0(mod2026).(i-j)^2+(a_i-a_j)^2 \equiv (1+45^2)(i-j)^2 \equiv 0 \pmod{2026}.(i−j)2+(a

So the constructed permutation is valid.

Solution written by GPT5.5

1,2,⋯,2026
1,2,⋯ ,20261,2,\cdots,20261,2,⋯,2026
j)
(mod2026).
i
​
−
aj​)2≡
(1+
452)(i−
j)2≡
0
(mod2026).