# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537428 |
2022-03-15T05:40:05 Z |
joelau |
Kpart (eJOI21_kpart) |
C++14 |
|
1344 ms |
393748 KB |
#include <bits/stdc++.h>
using namespace std;
int T,N,A[1005], sum[1005], dp[1005][100005];
vector<int> ans;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> T;
while (T--) {
cin >> N;
sum[0] = 0;
for (int i = 1; i <= N; ++i) {
cin >> A[i];
sum[i] = sum[i-1] + A[i];
}
memset(dp,0,sizeof(dp));
dp[0][0] = 1;
for (int i = 1; i <= N; ++i) for (int j = 0; A[i]+j <= 100000; ++j) if (dp[i-1][j]) dp[i][j] += dp[i-1][j], dp[i][A[i]+j] += dp[i-1][j];
for (int i = 1; i <= N; ++i) {
bool can = true;
for (int j = 1; i+j-1 <= N && can; ++j) {
int total = sum[i+j-1] - sum[j-1];
if (total % 2 != 0 || dp[i+j-1][total/2] == dp[j-1][total/2]) can = false;
}
if (can) ans.push_back(i);
}
cout << ans.size();
for (int x: ans) cout << ' ' << x;
cout << '\n';
ans.clear();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
901 ms |
393676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1090 ms |
393680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1344 ms |
393748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |