# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
640930 |
2022-09-15T14:54:33 Z |
alex_2008 |
Kpart (eJOI21_kpart) |
C++14 |
|
2000 ms |
340 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
typedef long long ll;
using namespace std;
const int N = 1e5 + 10;
int a[N], cnt[N];
bool Used[N];
void solve() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
cnt[i - 1] = 0;
}
Used[0] = true;
for (int i = 1; i <= n; i++) {
int cur = 0;
for (int j = i; j <= n; j++) {
for (int k = cur; k >= 0; k--)
if (Used[k]) Used[k + a[j]] = true;
cur += a[j];
if (cur % 2 == 0 && Used[cur / 2]) cnt[j - i]++;
}
}
vector <int> ans;
for (int i = 0; i < n; i++) {
if (cnt[i] == n - i) ans.push_back(i + 1);
}
cout << ans.size();
for (auto it : ans)
cout << " " << it;
cout << endl;
}
int main() {
int t;
cin >> t;
while (t--)
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
48 ms |
316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2076 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |