From f758d5659aeabece22811d4084dea325c3c64b97 Mon Sep 17 00:00:00 2001 From: Segcolt <9hmbzr275@mozmail.com> Date: Thu, 3 Oct 2024 17:21:12 -0300 Subject: [PATCH] Finish the problem There was just one thing missing from my logic, I should have saw that... Well, everything worked out in the end! --- CSES Problem Set/Two Sets II.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CSES Problem Set/Two Sets II.cpp b/CSES Problem Set/Two Sets II.cpp index 039ce61..9e7d0b2 100644 --- a/CSES Problem Set/Two Sets II.cpp +++ b/CSES Problem Set/Two Sets II.cpp @@ -87,7 +87,7 @@ int main() vvl dp(n + 1, vl((n * (n + 1) / 4) + 1, 0)); dp[0][0] = 1; - for (size_t i = 1; i <= n; i++) { + for (size_t i = 1; i < n; i++) { for (size_t j = 0; j <= (n * (n + 1) / 4); j++) { dp[i][j] += dp[i - 1][j]; if (j >= i) { @@ -98,5 +98,5 @@ int main() } // cout << dp; - cout << dp[n][(n * (n + 1) / 4)] / 2 << '\n'; + cout << dp[n - 1][(n * (n + 1) / 4)] << '\n'; }