*[백준/파이썬] 11651번 좌표 정렬하기 2 | lambda함수 이용 정렬
[최종 코드]import sysn = int(sys.stdin.readline())coor = []for i in range(n): a, b = map(int, input().split()) coor.append((a, b))coor.sort(key=lambda x: (x[1], x[0]))output_lines = [f'{x} {y}' for x, y in coor]sys.stdout.write('\n'.join(map(str, output_lines)) + '\n')[핵심 부분]coor.sort(key=lambda x: (x[1], x[0]))- lambda 함수를 이용해 (x, y)를 (y, x)로 바꾸기output_lines = [f'{x} {y}' for x, y in coor]sys..
2025. 10. 22.