본문 바로가기

PS 짬통/골랜디

23567 Double Rainbow

https://www.acmicpc.net/problem/23567

 

23567번: Double Rainbow

Let $P$ be a set of $n$ points on the $x$-axis and each of the points is colored with one of the colors $1, 2, \dots , k$. For each color 𝑖 of the 𝑘 colors, there is at least one point in $P$ which is colored with $i$. For a set $P'$ of consecutive p

www.acmicpc.net

 

빡세다, 문제 이해하는 것부터 시간이 좀 걸린다

 

가능한 P' 집합 포문으로 다 검사하면 시간초과 난다

 

투포인터로 풀어야한다

증명은 안되어있는데 잘 모르겠다

 

부분집합이 Rainbow 인지 체크할 때 좀 더 최적화가 가능한데 귀찮아서 안했다 

 

https://github.com/KimximyaFan/Random-Defense/blob/main/C0004.java

'PS 짬통 > 골랜디' 카테고리의 다른 글

2138 전구와 스위치  (0) 2023.09.07
17088 등차수열 변환  (1) 2023.09.06
11758 CCW  (0) 2023.09.04
11058 크리보드  (0) 2023.09.03
17845 수강 과목  (3) 2023.08.29