# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
637828 |
2022-09-03T11:50:07 Z |
ksu2009en |
Kpart (eJOI21_kpart) |
C++17 |
|
2000 ms |
652 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>
using namespace std;
typedef long long ll;
bitset<1000007>bs;
int main(){
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<ll>can(n + 1);
for(int i = 2; i <= n; i++){
if(can[i])
continue;
bool ok = false;
for(int j = 0; j + i - 1 < n; j++){
bs = 0;
bs[a[j]] = 1;
ll sum = a[j];
for(int k = j + 1; k < j + i; k++){
bs |= (bs << a[k]);
sum += a[k];
}
if(sum % 2 == 0 && (bs[sum / 2])){
continue;
}
ok = true;
break;
}
if(!ok){
can[i] = 1;
for(int j = i; j <= n; j += i)
can[j] = 1;
}
}
vector<ll>ans;
for(int i = 2; i <= n; i++)
if(can[i])
ans.push_back(i);
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 |
Correct |
268 ms |
648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2070 ms |
652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2023 ms |
596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |