#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> v(n+1), dp(100005), ans(n+1, 1), res;
for(int i=1; i<=n; i++) {
cin >> v[i];
int sum = 0; dp[v[i]] = i;
for(int j=100000; j>v[i]; j--) dp[j] = max(dp[j], dp[j-v[i]]);
for(int j=i; j>=1; j--) {
sum += v[j];
if(sum % 2 == 1 || dp[sum/2] < j) ans[i-j+1] = 0;
}
}
for(int i=1; i<=n; i++) if(ans[i]) res.push_back(i);
cout << res.size() << " ";
for(int &x : res) cout << x << " ";
cout << '\n';
}
int main() {
int t = 1; cin >> t;
while(t--) solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
97 ms |
972 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
366 ms |
1092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |