aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index f72a00e..1c829c4 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -159,12 +159,16 @@ is_perm(int *a, int n)
159{ 159{
160 int *aux = malloc(n * sizeof(int)); 160 int *aux = malloc(n * sizeof(int));
161 int i; 161 int i;
162 162
163 for (i = 0; i < n; i++) 163 for (i = 0; i < n; i++)
164 aux[i] = 0;
165
166 for (i = 0; i < n; i++) {
164 if (a[i] < 0 || a[i] >= n) 167 if (a[i] < 0 || a[i] >= n)
165 return false; 168 return false;
166 else 169 else
167 aux[a[i]] = 1; 170 aux[a[i]] = 1;
171 }
168 172
169 for (i = 0; i < n; i++) 173 for (i = 0; i < n; i++)
170 if (!aux[i]) 174 if (!aux[i])

Generated with cgit - Back to sebastiano.tronto.net