Skip to content

220822/이현동 #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion [Week18 - Search]/이현동/3649.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,45 @@
테스트의 개수
레고 조각의 수
구멍의 너비 x
'''
1 센티미터 = 10000000 나노미터
'''

import sys
input = sys.stdin.readline

SIZE = 10000000 # 단위, 나노미터 1센티미터

def findRightHole(N, hole, target):
l, r = 0, N-1

while l < r:
tmp = (hole[l] + hole[r])

if tmp == target:
return [hole[l], hole[r]]
elif tmp < target:
l += 1
else:
r -= 1

return [0, 0]

while True:
try:
x = int(input())
N = int(input())
hole = []
x *= SIZE
for _ in range(N):
hole.append(int(input()))

hole.sort()


ret = findRightHole(N, hole, x)
if ret == [0, 0]:
print("danger")
else:
print("yes {} {}".format(ret[0], ret[1]))
except:
break