DOJ logoDOJ
Problems
Recently added problemsSaved problemsWorkbooks
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 account linking.

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

Rating Updates

Back to problem

Editorial

Maintain the current rating RRR. Read the performances PiP_iPi​ in order and update R←(3R+Pi)/4R\leftarrow (3R+P_i)/4R←(3R+Pi​)/4 each time. Every updated rating is guaranteed to be an integer, so no rounding rule is needed.

Initially, R=R0R=R_0R=R0​. If R=RiR=R_iR=Ri​ after processing the -th performance, applying the given formula to the next performance makes . By induction, after all contests .

Because RRR and PiP_iPi​ are at most 5⋅1085\cdot10^85⋅108, the numerator 3R is at most . Thus, every calculation fits in a 32-bit signed integer.

The same method applies to subtask 1. Its condition Pi≥Ri−1P_i\geq R_{i-1}Pi​≥Ri−1​ means that the rating does not decrease, but the update formula is unchanged. Across either subtask, the total time complexity is O(T+∑N)O(T+\sum N)O and the extra space complexity is when the input is streamed.

Solution written by GPT5

ii
i
R=Ri+1R=R_{i+1}R=Ri+1​
R=RNR=R_NR=RN​
+Pi3R+P_i
3R+Pi​
2⋅1092\cdot10^92⋅109
(
T
+
∑N)
O(1)O(1)O(1)