#include <bits/stdc++.h>
using namespace std;
const int LIMIT = 25000;
bitset<LIMIT+5> dp[125];
int v[125];
int fr[125];
signed main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int T; cin>>T; while(T--)
    {
        int n; cin>>n;
        for(int i=1; i<=n; ++i)
        {
            cin>>v[i];
            fr[i] = 0;
        }
        for(int i=1; i<=n; ++i)
        {
            for(int j=0; j<=n-i+1; ++j)
                dp[j].reset();
            dp[0][0] = 1;
            for(int j=i; j<=n; ++j)
            {
                for(int k = 0; k <= LIMIT; ++k)
                    if(dp[j-i][k])
                    {
                        if(k + v[j] <= LIMIT)
                            dp[j-i+1][k + v[j]] = 1;
                        dp[j-i+1][abs(k - v[j])] = 1;
                    }
                if(dp[j-i+1][0])
                    ++fr[j-i+1];
            }
        }
        vector<int> ok;
        for(int i=1; i<=n; ++i)
            if(fr[i] == n - i + 1)
                ok.push_back(i);
        cout<<ok.size();
        for(auto &i : ok) cout<<' '<<i;
        cout<<'\n';
    }
    return 0;
}
/*
2
7
7 3 5 1 3 3 5
6
1 2 3 5 8 3
*/
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |