Candidate | Softeer Assessment UI
Candidate | Softeer Assessment UI
softeer.ai
나의 풀이
import sys
from collections import deque
input = sys.stdin.readline
limit_ct, test_ct = list(map(int,input().split()))
limit_list = deque()
test_list = deque()
for _ in range(limit_ct):
limit_list.append(list(map(int,input().split())))
for _ in range(test_ct):
test_list.append(list(map(int,input().split())))
max_speed_up=0
limit_lenth, limit_speed = 0,0
test_lenth, test_speed = 0,0
while test_list or limit_list:
if limit_lenth==0:
limit_lenth, limit_speed = limit_list.popleft()
if test_lenth==0:
test_lenth, test_speed = test_list.popleft()
now_speed = test_speed-limit_speed
max_speed_up=max(max_speed_up, now_speed)
if test_lenth>limit_lenth:
test_lenth-=limit_lenth
limit_lenth=0
elif limit_lenth>test_lenth:
limit_lenth-=test_lenth
test_lenth=0
else:
limit_lenth=0
test_lenth=0
print(max_speed_up)'코딩테스트 파이썬 > Softeer' 카테고리의 다른 글
| Softeer 연습문제(2단계) - 장애물 인식 프로그램 (0) | 2024.06.26 |
|---|---|
| Softeer 연습문제(2단계) - 진정한 효도 (1) | 2024.06.26 |
| Softeer 연습문제(2단계) - 금고털이 (0) | 2024.06.25 |
| Softeer 연습문제(2단계) - 연탄의 크기 (0) | 2024.06.25 |
| Softeer 연습문제(2단계) - X marks the Spot (0) | 2024.06.25 |