# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
637890 |
2022-09-03T14:04:53 Z |
ksu2009en |
Kpart (eJOI21_kpart) |
C++17 |
|
2000 ms |
1284 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 long long 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 + 1, vector<ll>(n + 1));
for(int i = 0; i < n; i++){
bs = 0;
bs[a[i]] = 1;
ll sum = a[i];
for(int j = i + 1; j < n; j++){
sum += a[j];
bs |= (bs << a[j]);
bs[a[j]] = 1;
if(sum % 2 == 0 && bs[sum])
can[i][j - i + 1] = 1;
}
}
/*
for(int i = 0; i < n; i++){
for(int j = 0; j <= n; j++)
cout << can[i][j] << ' ';
cout << endl;
}
*/
vector<ll>ans;
for(int j = 2; j <= n; j++){
bool ok = false;
for(int i = 0; i < n; i++){
if(i + j - 1 >= n)
continue;
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;
}
/*
1
9
3 2 4 5 1 2 6 7 1
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
105 ms |
676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
704 ms |
840 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2077 ms |
1284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |