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

Sinoka Studies Graphics

Back to problem

Editorial

Fix one vertex of a convex polygon with AiA_iAi​ vertices and draw diagonals from it to all nonadjacent vertices. This divides the polygon into Ai−2A_i-2Ai​−2 triangles. Print Ai−2A_i-2Ai​−2 for each polygon. The total time complexity is O(∑N)O(\sum N)O(∑N).

Solution written by GPT6