| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 32925 |
| 문제명 | Just Half is Enough |
| 레벨 | 골드 4 |
| 분류 |
ad hoc |
| 시간복잡도 | O(E) |
| 인풋사이즈 | E<=2*10^5 |
| 사용한 언어 | Python 3.13 |
| 제출기록 | 37048KB / 212ms |
| 최고기록 | 212ms |
| 해결날짜 | 2026/02/14 |
"""Solution code for "BOJ 32925. Just Half is Enough".
- Problem link: https://www.acmicpc.net/problem/32925
- Solution link: http://www.teferi.net/ps/problems/boj/32925
Tags: [ad hoc]
"""
import sys
from teflib import psutils
@psutils.run_n_times
def main():
n, m = [int(x) for x in sys.stdin.readline().split()]
inc_order_count = 0
for _ in range(m):
u, v = [int(x) - 1 for x in sys.stdin.readline().split()]
if u < v:
inc_order_count += 1
if inc_order_count >= (m + 1) // 2:
print(*range(1, n + 1))
else:
print(*reversed(range(1, n + 1)))
if __name__ == '__main__':
main()