From 1b19955e5357e8939a7d7821125438bf65edebab Mon Sep 17 00:00:00 2001 From: stopnoanime Date: Fri, 29 Dec 2023 13:55:27 +0100 Subject: [PATCH] fix piggybanks_dfs --- src/cw9/zad1/piggybanks_dfs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cw9/zad1/piggybanks_dfs.cpp b/src/cw9/zad1/piggybanks_dfs.cpp index 0bfe0f4..bd74f53 100644 --- a/src/cw9/zad1/piggybanks_dfs.cpp +++ b/src/cw9/zad1/piggybanks_dfs.cpp @@ -22,7 +22,7 @@ int piggybanks_dfs(std::vector piggybanks) { cycles[next_pig] = i; next_pig = piggybanks[next_pig]; } - if (next_pig == i) closed_cycles_count++; + if (cycles[next_pig] == i) closed_cycles_count++; } }