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

DOJ 서비스 종료

Back to problem

Editorial

분탕 기여자의 수를 BBB, 중국 출신 유저의 수를 CCC, 분탕 기여자인 중국 출신 유저의 수를 XXX라고 하자. 입력 조건에 의해 BBB와 CCC는 모두 양수이다.

분탕 기여자 중 중국 출신의 비율은 XB\frac{X}{B}BX​이고, 중국 출신 중 분탕 기여자의 비율은 XC\frac{X}{C}CX​이다. 따라서 두 비율이 같을 조건은

XB=XC\frac{X}{B}=\frac{X}{C}BX​=CX​

이다.

양변에 BCBCBC를 곱하면 XC=XBXC=XBXC=XB이고, 이는 X(C−B)=0X(C-B)=0X(C−B)=0과 같다. 그러므로 두 비율이 같으려면 이거나 여야 하며, 그 역도 성립한다.

따라서 입력을 한 번 순회하면서 BBB, CCC, XXX를 세고, X=0X=0X=0 또는 B=CB=CB=C이면 good-kolorvxl을 출력하고, 그렇지 않으면 을 출력하면 된다.

시간 복잡도는 O(N)O(N)O(N)이고, 메모리 복잡도는 O(1)O(1)O(1)이다.

Solution written by GPT5.5

X=0X=0
X=0
B=CB=CB=C
bad-kolorvxl