From c21770197693840470c6802acbb429469cde2552 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Sat, 25 Jul 2026 15:41:11 +0900 Subject: [PATCH 1/2] =?UTF-8?q?14889=20:=20=EC=8A=A4=ED=83=80=ED=8A=B8?= =?UTF-8?q?=EC=99=80=20=EB=A7=81=ED=81=AC=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week5/BOJ14889/BOJ14889_V1.cpp | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/week5/BOJ14889/BOJ14889_V1.cpp diff --git a/src/week5/BOJ14889/BOJ14889_V1.cpp b/src/week5/BOJ14889/BOJ14889_V1.cpp new file mode 100644 index 0000000..7f53eb0 --- /dev/null +++ b/src/week5/BOJ14889/BOJ14889_V1.cpp @@ -0,0 +1,60 @@ +#include +using namespace std; +int N; +int input_arr[20][20]; +int ret = INT_MAX; +int check(int team_bit) { + int a_sum=0; + int b_sum=0; + for (int i=0; i b) { + if (b.size() == N/2) { + int team_bit = 0; + for (int num : b) { + team_bit |= (1 << num); + } + + int diff = check(team_bit); + ret = min(ret, diff); + + return; + } + + for (int i=st+1; i> N; + for (int i=0; i> input_arr[i][j]; + } + } + vector b; + combi(-1,b); + cout << ret; + + + return 0; +} \ No newline at end of file From 854ed45447f5e323947a4a8a545fe4ad8987ae42 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Sat, 25 Jul 2026 15:51:21 +0900 Subject: [PATCH 2/2] =?UTF-8?q?14889=20:=20=EC=8A=A4=ED=83=80=ED=8A=B8?= =?UTF-8?q?=EC=99=80=20=EB=A7=81=ED=81=AC=20V2=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week5/BOJ14889/BOJ14889_V2.cpp | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/week5/BOJ14889/BOJ14889_V2.cpp diff --git a/src/week5/BOJ14889/BOJ14889_V2.cpp b/src/week5/BOJ14889/BOJ14889_V2.cpp new file mode 100644 index 0000000..9a83405 --- /dev/null +++ b/src/week5/BOJ14889/BOJ14889_V2.cpp @@ -0,0 +1,44 @@ +#include +using namespace std; +int N; +int input_arr[20][20]; +int ret = INT_MAX; +int check(vector a, vector b) { + int a_sum=0; + int b_sum=0; + + for (int i=0; i> N; + for (int i=0; i> input_arr[i][j]; + } + } + for (int i=0; i<(1< a,b; + for (int j=0; j