# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
637860 |
2022-09-03T12:29:49 Z |
ksu2009en |
Kpart (eJOI21_kpart) |
C++17 |
|
2000 ms |
1180 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, vector<ll>(n + 1));
for(int i = 0; i < n; i++){
bs = 0;
ll sum = 0;
for(int j = i; j < n; j++){
sum += a[j];
bs[a[j]] = 1;
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;
}
/*
1
9
3 2 4 5 1 2 6 7 1
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
118 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
752 ms |
720 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2084 ms |
1180 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |