https://www.acmicpc.net/problem/17224
17224번: APC는 왜 서브태스크 대회가 되었을까?
2019년 올해도 어김없이 아주대학교 프로그래밍 경시대회(Ajou Programming Contest, APC)가 열렸다! 올해 새롭게 APC의 총감독을 맡게 된 준표는 대회 출제 과정 중 큰 고민에 빠졌다. APC에 참가하는 참가
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
def sol(l,k,score,problems,is_hard):
if is_hard==1:
plus_score=140
location=1
else:
plus_score=100
location=0
problems.sort(key= lambda x: x[location])
while k>0:
if l >= problems[0][location]:
problems.pop(0)
k-=1
score+=plus_score
else:
break
return [k,score,problems]
n,l,k=map(int, input().split())
score=0
problems=[]
for i in range(n):
sub1,sub2=map(int,input().split())
problems.append([sub1,sub2])
k,score,problems=sol(l,k,score,problems,1)
answer=sol(l,k,score,problems,0)[1]
print(answer)
|
cs |
어려운 난이도 기준으로 정렬 먼저하고 문제를 풀 수 있으면 그 문제는 리스트에서 pop, 총 문제 풀수있는 갯수 -1
쉬운 난이도도 위와 같음
Sort by difficulty level(sub2) first and if you can solve the problem, the problem is popped from the list, the total number of problems that can be solved -1
Easy difficulty level is the same as above.
반응형
'python-algorithm' 카테고리의 다른 글
백준 25496 장신구 명장 임스 (0) | 2022.10.17 |
---|---|
백준 1251 단어 나누기 (0) | 2022.10.17 |
백준 16466 콘서트 (0) | 2022.10.13 |
백준 2204 도비의 난독증 테스트 (0) | 2022.10.12 |
백준 10989 수 정렬하기 3 (0) | 2022.10.11 |
댓글