#include #include #include #define LL long long #define Mod 1000000007 using namespace std; using namespace std; int a[22], H[22]; int mid(int a, int b) { if(a > b) swap(a, b); if(a == 1 && b == 9) return 5; if(a == 3 && b == 7) return 5; if((a <= 3 && b == a + 6) || (a % 3 == 1 && b == a + 2)) return (a+b)/2; return -1; } bool Judge(int n) { if(n < 4) return false; memset(H, 0, sizeof(H)); for(int i=0; i 9) return false; if(H[a[i]]) return false; H[a[i]]++; } bool vis[22]; memset(vis, false, sizeof(vis)); for(int i=1; i