| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 20309 |
| 문제명 | 트리플 소트 |
| 레벨 | 실버 3 |
| 분류 |
불변량 |
| 시간복잡도 | O(n) |
| 인풋사이즈 | n<=300000 |
| 사용한 언어 | Python 3.13 |
| 제출기록 | 62196KB / 116ms |
| 최고기록 | 112ms |
| 해결날짜 | 2025/11/13 |
"""Solution code for "BOJ 20309. 트리플 소트".
- Problem link: https://www.acmicpc.net/problem/20309
- Solution link: http://www.teferi.net/ps/problems/boj/20309
Tags: [invariant]
"""
def main():
_N = int(input())
arr = [int(x) for x in input().split()]
is_sortable = all(x % 2 == 1 for x in arr[::2])
print('YES' if is_sortable else 'NO')
if __name__ == '__main__':
main()