https://www.acmicpc.net/problem/2456
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
first,second,third=[],[],[]
n=int(input())
for i in range(n):
a,b,c=map(int, input().split())
first.append(a)
second.append(b)
third.append(c)
first = [sum(first), first.count(3), first.count(2), first.count(1),1]
second = [sum(second), second.count(3), second.count(2), second.count(1),2]
third = [sum(third), third.count(3), third.count(2), third.count(1),3]
answer=[first,second,third]
answer.sort(key= lambda x: (x[0],x[1],x[2]), reverse=True)
if answer[0][:4]==answer[1][:4]:
print(0,answer[0][0])
else:
print(answer[0][4],answer[0][0])
|
cs |
정렬과 카운팅을 통해 풀었습니다
Use Sort, count
반응형
'python-algorithm' 카테고리의 다른 글
백준 13322 접두사 배열 (0) | 2022.10.29 |
---|---|
백준 9455 박스 (0) | 2022.10.29 |
백준 4641 Doubles (0) | 2022.10.29 |
백준 13235 팰린드롬 (0) | 2022.10.28 |
백준 14696 딱지놀이 (0) | 2022.10.28 |
댓글