# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
975340 |
2024-05-04T20:35:50 Z |
andro |
Kpart (eJOI21_kpart) |
C++14 |
|
2000 ms |
816 KB |
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N = 1e6;
bitset<N> dp;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t-- ) {
int n;
cin >> n;
vector<int> a(n + 1);
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
vector<int> ans;
vector<int> pref(n + 1);
for(int i = 1; i <= n; i++) {
pref[i] = pref[i - 1] + a[i];
}
for(int k = 1; k <= n; k++) {
dp[0] = 1;
for(int i = 1; i <= k; i++) {
dp |= (dp << a[i]);
}
if(pref[k] % 2) {
continue;
}
int ok = 1;
for(int i = k + 1; i <= n; i++) {
dp &= (dp >> a[i - k]);
dp |= (dp << a[i]);
if((pref[i] - pref[i - k]) % 2) {
ok = 0;
break;
}
if(! dp[(pref[i] - pref[i - k]) / 2]) {
ok = 0;
break;
}
}
dp.reset();
if(ok) {
ans.push_back(k);
}
}
cout << ans.size() << " ";
for(auto it : ans) {
cout << it << " ";
}
cout << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
179 ms |
800 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1412 ms |
812 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2020 ms |
816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |