# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
637857 |
2022-09-03T12:25:03 Z |
ksu2009en |
Kpart (eJOI21_kpart) |
C++17 |
|
2000 ms |
936 KB |
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#define endl '\n'
using namespace std;
typedef int ll;
bitset<1000007>bs;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t;
cin >> t;
while(t--){
ll n;
cin >> n;
vector<ll>a(n);
for(int i = 0; i < n; i++)
cin >> a[i];
vector<vector<ll>>can(n, vector<ll>(n + 1));
for(int i = 0; i < n; i++){
bs = 0;
ll sum = 0;
bs[a[i]] = 1;
for(int j = i; j < n; j++){
sum += a[j];
bs |= (bs << a[j]);
can[i][j - i + 1] = (sum % 2 == 0 ? bs[sum / 2] : 0);
}
}
vector<ll>ans;
for(int j = 1; j <= n; j++){
bool ok = false;
for(int i = 0; i + j - 1 < n; i++){
if(!can[i][j])
ok = true;
}
if(!ok)
ans.push_back(j);
}
cout << ans.size() << ' ';
for(auto i: ans)
cout << i << ' ';
cout << endl;
}
return 0;
}
/*
3 1
3 4 5
1 2 90
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
596 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
788 ms |
696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2068 ms |
936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |