Submission #634429

# Submission time Handle Problem Language Result Execution time Memory
634429 2022-08-24T11:39:45 Z uncripted Kpart (eJOI21_kpart) C++11
0 / 100
77 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];
			las[i]=-1;
			pas[i]=1;
			sum+=a[i];
		}
		las[0]=0;
		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]]);
			}
			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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -