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'; }