# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
537491 |
2022-03-15T07:17:12 Z |
zaneyu |
Kpart (eJOI21_kpart) |
C++14 |
|
2000 ms |
352 KB |
/*input
2
7
7 3 5 1 3 3 5
6
1 1 1 1 1 1
*/
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define ll long long
#define ld long double
#define sz(x) (int)x.size()
#define pb push_back
const int maxn=1e3+5;
int arr[maxn];
bool wk[maxn];
void solve(){
int n;
cin>>n;
REP(i,n) cin>>arr[i];
REP1(i,n) wk[i]=1;
REP(i,n){
int s=0;
bitset<100005> bs;
bs[0]=1;
for(int j=i;j<n;j++){
bs|=(bs<<arr[j]);
s+=arr[j];
if(s%2 or !bs[s/2]) wk[j-i+1]=0;
}
}
int cnt=0;
REP1(i,n) cnt+=wk[i];
cout<<cnt<<' ';
REP1(i,n) if(wk[i]) cout<<i<<' ';
cout<<'\n';
}
int main(){
ios::sync_with_stdio(false),cin.tie(0);
int t;
cin>>t;
while(t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
340 KB |
Output is correct |
2 |
Correct |
343 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1558 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
2092 ms |
352 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |