(I2
I144
I6
(dp0
Vtable.%l
p1
(Vb.cpp
p2
S"# include <bits/stdc++.h>\r\nusing namespace std;\r\n# define fi cin\r\n# define fo cout\r\nset < int > a;\r\nset < int > b;\r\nset < int > c;\r\nint us[77];\r\nint mn[2][77];\r\nint mx[2][77];\r\nint s[2][77];\r\nint n;\r\nset < int > era(set < int > u,int cnt)\r\n{\r\n    u.erase(cnt);\r\n    return u;\r\n}\r\nint get(set < int > a,set < int > b,set < int > c,int col,int lin)\r\n{\r\n    int ans = 0;\r\n    if (col == 1 && !a.empty()) return 0;\r\n    if (col == 1 && lin == n) return 1;\r\n    if (col == 0)\r\n    {\r\n        for (auto it : a)\r\n            if (mn[col][lin] <= it && it <= mx[col][lin] && it > s[col][lin-1]) s[col][lin] = it,ans += get(era(a,it),b,c,lin == n ? col+1:col,lin == n ? 1:lin+1);\r\n    }\r\n    if (col == 1)\r\n    {\r\n        for (auto it : b)\r\n            if (mn[col][lin] <= it && it <= mx[col][lin] && it > s[col][lin-1] && it > s[col-1][lin]) s[col][lin] = it,ans += get(a,era(b,it),c,lin == n ? col+1:col,lin == n ? 1:lin+1);\r\n    }\r\n    for (auto it : c)\r\n        if (mn[col][lin] <= it && it <= mx[col][lin] && it > s[col][lin-1] && (col ? it > s[col-1][lin]:1)) s[col][lin] = it,ans += get(a,b,era(c,it),lin == n ? col+1:col,lin == n ? 1:lin+1);\r\n    return ans;\r\n}\r\nint main(void)\r\n{\r\n    fi>>n;\r\n    int nw;\r\n    int m,k;\r\n    fi>>m;\r\n    while (m --) fi>>nw,a.insert(nw),us[nw] = 1;\r\n    fi>>k;\r\n    while (k --) fi>>nw,b.insert(nw),us[nw] = 1;\r\n    for (int i = 1;i <= n+n;++i)\r\n        if (!us[i])\r\n            c.insert(i);\r\n    for (int i = 0;i < 2;++i)\r\n        for (int j = 1;j <= n;++j)\r\n            mx[i][j] = 2*n - (n - j + (n - j + 1) * (1 - i)),mn[i][j] = j + i*j;\r\n    return fo << get(a,b,c,0,1) << '\\n',0;\r\n}\r\n"
p3
tp4
stp5
.