summaryrefslogtreecommitdiffstats
path: root/šola/p2/dn/DN07a_63230317.c
diff options
context:
space:
mode:
Diffstat (limited to 'šola/p2/dn/DN07a_63230317.c')
-rw-r--r--šola/p2/dn/DN07a_63230317.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/šola/p2/dn/DN07a_63230317.c b/šola/p2/dn/DN07a_63230317.c
new file mode 100644
index 0000000..3bc5323
--- /dev/null
+++ b/šola/p2/dn/DN07a_63230317.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+int globina (int * t) {
+ fprintf(stderr, "-> %d %d\n", t[0], t[1]);
+ if (!t[0] && !t[1])
+ return 0;
+ int r = 0;
+ if (t[0])
+ r = globina(t+2*t[0]);
+ if (t[1]) {
+ int g = globina(t+2*t[1]);
+ if (g > r)
+ r = g;
+ }
+ return r+1;
+
+}
+int main (void) {
+ int n;
+ scanf("%d\n", &n);
+ int t[2*n];
+ for (int i = 0; i < 2*n; i++)
+ scanf("%d", &t[i]);
+ printf("%d\n", globina(t));
+}