传送门

写个Bfs打表,然后你就会很神奇的发现不同数列的个数和序列里元素的排布是没有任何关系的,然后就很容易找到规律了。除了1和3的时候需要特判一下,其它的时候都是规律的,Orz神仙打表题。

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 16600;
int x[maxn];
signed main()
{
    //freopen("in","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i = 0;i < n; i++)
        cin >> x[i];
    if(n == 1)
        cout << 1 << endl;
    else if(n == 3)
        cout << 6 << endl;
    else if(n % 4 == 1)
        cout << n * 2 << endl;
    else if(n % 4 == 2)
        cout << n << endl;
    else if(n % 4 == 3)
        cout << 12 << endl;
    else if(n % 4 == 0)
        cout << 4 << endl;
    return 0;
}