Submission #634433

# Submission time Handle Problem Language Result Execution time Memory
634433 2022-08-24T11:50:33 Z uncripted Kpart (eJOI21_kpart) C++11
0 / 100
50 ms 340 KB
#include<bits/stdc++.h>
using namespace std;	
int las[100005];
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		int a[n+1];
		int pas[n+1];
		int sum=0;
		for(int i=1; i<=n; i++){
			cin>>a[i];
			pas[i]=1;
			sum+=a[i];
		}
		las[0]=0;
		sum/=2;
		for(int i=1; i<=n; i++){
			for(int j=sum-a[i]; j>0; j--){
				las[j+a[i]]=max(las[j], las[j+a[i]]);
			}
			if(a[i]<=sum){
				las[a[i]]=i;	
			}
			
			int s=0;
			for(int j=i; j>=1; j--){
				s+=a[j];
				if(s%2==1){
					pas[i-j+1]=0;
					continue;
				}
				if(las[s/2]<j){
					pas[i-j+1]=0;
				}
			}
		}
		int p=0;
		for(int i=2; i<=n; i++){
			if(pas[i]==1){
				p++;
			}
		}
		cout<<p<<" ";
		for(int i=2; i<=n; i++){
			if(pas[i]==1){
				cout<<i<<" ";
			}
		}
		cout<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -