From e6bcb6f6546a14eebcdbe38ea9104225feec4ece Mon Sep 17 00:00:00 2001 From: Segcolt <9hmbzr275@mozmail.com> Date: Sat, 2 Nov 2024 16:27:53 -0300 Subject: [PATCH] Actually do the problem I completely forgot to commit this one... --- .../Cards Distribution.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/Data Structures and Libraries/Cards Distribution.cpp b/Data Structures and Libraries/Cards Distribution.cpp index f5f8fc2..2bea532 100644 --- a/Data Structures and Libraries/Cards Distribution.cpp +++ b/Data Structures and Libraries/Cards Distribution.cpp @@ -87,7 +87,7 @@ int main() } vi cards; - ll total = 0; + int total = 0; while (n--) { string a; @@ -96,23 +96,10 @@ int main() total += cards.back(); } - size_t i = 0; - size_t j = 0; - int cmax = 0; - int now = 0; - while (j < cards.size()) { - if (total - now < now) { - now -= cards[i]; - i++; - continue; - } - now += cards[j]; - j++; - rmax(cmax, now); - } + int cmax = max(cards[0], total / p); int amax = 0; - now = 0; + int now = 0; int num = 0; for (auto i : cards) { if (now + i > cmax) {