#include #include #define MAX 25 bool visited[4*MAX]; long long nb = 0; void explore(int n4, int p, int rem) { if (rem==0) { nb++; } else { while (visited[p]) { p++; } // we force the first first differences to be > 1 // the exploration will avoid a(n-1) cases for (int d=p==0 ? 2 : 1; p+3*d