반례입니다.
11004번 - K번째 수
코드가 틀려서 오답 처리 되는 것 외에도 python3에서 시간 초과가 나는 이유는 그냥 python과 deque가 원래 느려서 그렇습니다.
import time
current = time.time()
a=[]
for i in range(5_000_000):
a.append(i)
print(time.time()-current) # 0.4초
import time
from collections import deque
current = time.time()
a=deque()
for i in range(5_000_000):
a.append(i)
print(time.time()-current) # 0.35초댓글을 작성하려면 로그인해야 합니다.
sybby 2년 전
radix sort로 구현했는데요.pypy로 돌리면 '틀렸습니다'가 나오고, python3으로 돌리면 시간초과가 납니다. 아무리 돌려봐도 에러는 없어보이는데 뭐가 문제인지 모르겠네요