From c5fcf7179a83ef65c86c6a4a390029149e518649 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Tue, 5 Oct 2021 21:49:54 +0200 Subject: Duzy commit ze smieciami --- Semestr 4/aisd/pracownia2/rozw.cpp | 59 -------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 Semestr 4/aisd/pracownia2/rozw.cpp (limited to 'Semestr 4/aisd/pracownia2/rozw.cpp') diff --git a/Semestr 4/aisd/pracownia2/rozw.cpp b/Semestr 4/aisd/pracownia2/rozw.cpp deleted file mode 100644 index dd0d700..0000000 --- a/Semestr 4/aisd/pracownia2/rozw.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -using namespace std; - -const int MAX_SUM = 1e6; -const int N = 2e3 + 10; - -unordered_map sums; -vector> v; - -int main() { - int n; - scanf("%d", &n); - sums[0] = 0; - for (int i = 0; i < n; i++) { - int h; - scanf("%d", &h); - v.clear(); - for (auto kv: sums) { - v.push_back(kv); - } - - for (auto kv: v) { - int dif = kv.first, best = kv.second; - cout << dif << " " << best << "\n"; - int aux = 0; - if (dif >= 0) { - aux = h; - } else if (dif + h > 0) { - aux = dif + h; - } - - cout << ">aux: " << aux << " "; - sums[dif + h] = max(sums[dif + h], best + aux); - aux = 0; - if (dif <= 0) { - aux = h; - } else if (dif - h < 0) { - aux = h - dif; - } - cout << aux << "\n"; - sums[dif - h] = max(sums[dif - h], best + aux); - } - cout << "---\n"; - } - for (auto kv: sums) { - printf("%d %d\n", kv.first, kv.second); - } - - if (sums[0] != 0) { - printf("TAK\n%d\n", sums[0]); - } else { - int mini = 1e9; - sums.erase(0); - for (auto kv: sums) { - mini = min(mini, abs(kv.first)); - } - printf("NIE\n%d\n", mini); - } -} \ No newline at end of file -- cgit v1.2.3