-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path인사고과.Py
More file actions
22 lines (22 loc) · 973 Bytes
/
인사고과.Py
File metadata and controls
22 lines (22 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def solution(scores):
answer = 0
if len(scores) == 1:
return 1
wanho_score = scores[0][1] + scores[0][0]
# sorted_scores = sorted(scores, key=lambda x : (-x[0], -x[1]))
sorted_scores = sorted(scores, key=lambda x : (-x[0], x[1]))
# before_attitude_score = sorted_scores[0][0]
max_reputation_score = sorted_scores[0][1]
incentive_list = []
for attitude_score, reputation_score in sorted_scores:
if reputation_score >= max_reputation_score :
incentive_list.append(attitude_score +reputation_score)
max_reputation_score =reputation_score
# elif before_attitude_score == attitude_score :
# incentive_list.append(attitude_score +reputation_score)
else :
if attitude_score == scores[0][0] and reputation_score == scores[0][1]:
return -1
incentive_list.sort(reverse=True)
answer= incentive_list.index(wanho_score)+1
return answer