From bb31d0ee3712fad55f081dedf9b26b4580b12579 Mon Sep 17 00:00:00 2001 From: oncsr Date: Thu, 28 Aug 2025 12:09:02 +0900 Subject: [PATCH] =?UTF-8?q?[20250828]=20BOJ=20/=20P4=20/=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=EC=9D=80=20=EB=8B=A4=EC=8B=9C=20=EC=9B=80=EC=A7=81?= =?UTF-8?q?=EC=9D=B8=EB=8B=A4=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...00\354\247\201\354\235\270\353\213\244.md" | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 "khj20006/202508/28 BOJ P4 \354\213\234\352\260\204\354\235\200 \353\213\244\354\213\234 \354\233\200\354\247\201\354\235\270\353\213\244.md" diff --git "a/khj20006/202508/28 BOJ P4 \354\213\234\352\260\204\354\235\200 \353\213\244\354\213\234 \354\233\200\354\247\201\354\235\270\353\213\244.md" "b/khj20006/202508/28 BOJ P4 \354\213\234\352\260\204\354\235\200 \353\213\244\354\213\234 \354\233\200\354\247\201\354\235\270\353\213\244.md" new file mode 100644 index 00000000..5656384b --- /dev/null +++ "b/khj20006/202508/28 BOJ P4 \354\213\234\352\260\204\354\235\200 \353\213\244\354\213\234 \354\233\200\354\247\201\354\235\270\353\213\244.md" @@ -0,0 +1,90 @@ +```java +import java.util.*; +import java.io.*; + +class IOController { + BufferedReader br; + BufferedWriter bw; + StringTokenizer st; + + public IOController() { + br = new BufferedReader(new InputStreamReader(System.in)); + bw = new BufferedWriter(new OutputStreamWriter(System.out)); + st = new StringTokenizer(""); + } + + String nextLine() throws Exception { + String line = br.readLine(); + st = new StringTokenizer(line); + return line; + } + + String nextToken() throws Exception { + while (!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + + int nextInt() throws Exception { + return Integer.parseInt(nextToken()); + } + + long nextLong() throws Exception { + return Long.parseLong(nextToken()); + } + + double nextDouble() throws Exception { + return Double.parseDouble(nextToken()); + } + + void close() throws Exception { + bw.flush(); + bw.close(); + } + + void write(String content) throws Exception { + bw.write(content); + } + +} + +public class Main { + + static IOController io; + + // + + static int N; + static int[] a; + static boolean[][] dp; + + public static void main(String[] args) throws Exception { + + io = new IOController(); + + N = io.nextInt(); + a = new int[200001]; + for(int i=0;i 1) dp[i][1] = false; + else dp[i][1] = true; + } + for(int t=2;t<450;t++) for(int i=(t-1)*t+t-1;i<=200000;i++) { + if(a[i] - a[i-1] == 0) dp[i][t] = dp[i-1][t]; + if(dp[i-2*t+1][t-1] && (a[i-t]-a[i-2*t+1] == 0)) dp[i][t] = true; + } + for(int t=1;t<450;t++) if(dp[200000][t]) { + io.write("YES"); + io.close(); + return; + } + io.write("NO"); + + io.close(); + + } + +} +```