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
Revision historyCurrent post
Revision 1Problem-GeneralMarkdown

예제 입/출력

jtw7913Aug 12, 2026, 7:01 PM
316

예제 입력1

5 7
1 2 3
1 3 5
2 3 1
2 4 4
3 4 2
3 5 6
4 5 3

예제 출력1

9

예제 입력2

5 4
1 2 1
2 3 2
1 3 4
4 5 1

예제 출력2

IMPOSSIBLE

예제 입력3

1 3
1 1 100
1 1 -3
1 1 5

예제 출력3

0