Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 26 | 27 | 28 |
Tags
- Incognito
- 백준
- 그리디 알고리즘
- C
- php
- 정렬
- wargame
- writeup
- Text
- HackCTF
- N0Named
- 구현
- 수학
- Web
- 인코그니토
- 사칙연산
- Database
- Digital Forensics
- 써니나타스
- Forensics
- cryptography
- Network
- SuNiNaTas
- CTF
- misc
- MySQL
- Web Hacking
- xcz.kr
- Python
- 문자열
Archives
- Today
- Total
보안을 그리다, 훈이
[Baekjoon/Python3] 11650번 좌표 정렬하기 본문
[Baekjoon/Python3] 11650번 좌표 정렬하기
11650번: 좌표 정렬하기
첫째 줄에 점의 개수 N (1 ≤ N ≤ 100,000)이 주어진다. 둘째 줄부터 N개의 줄에는 i번점의 위치 xi와 yi가 주어진다. (-100,000 ≤ xi, yi ≤ 100,000) 좌표는 항상 정수이고, 위치가 같은 두 점은 없다.
www.acmicpc.net
# 메모리 : 49204KB / 시간 : 4876ms / 코드 길이 : 163B
n = int(input())
locations = []
for i in range(n):
locations.append(list(map(int, input().split())))
locations.sort()
for j in locations:
print(j[0], j[1])
# 메모리 : 58508KB / 시간 : 464ms / 코드 길이 : 266B
import sys
n = int(sys.stdin.readline())
locations = []
for i in range(n):
locations.append(list(map(int, sys.stdin.readline().split())))
locations.sort(key = lambda lo: [lo[0], lo[1]])
for j in locations:
sys.stdout.write(str(j[0]) + ' ' + str(j[1]) + '\n')
'Programming > Python & Data Structures' 카테고리의 다른 글
[Baekjoon/Python3] 11652번 카드 (0) | 2020.12.07 |
---|---|
[Baekjoon/Python3] 11651번 좌표 정렬하기 2 (0) | 2020.12.07 |
[Baekjoon/Python3] 11508번 2+1 세일 (0) | 2020.12.07 |
[Baekjoon/Python3] 11399번 ATM (0) | 2020.12.07 |
[Baekjoon/Python3] 11382번 꼬마 정민 (0) | 2020.12.07 |
Comments