Submission #1008687

#TimeUsernameProblemLanguageResultExecution timeMemory
1008687m5588ohammedBootfall (IZhO17_bootfall)C++14
28 / 100
11 ms860 KiB
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; #define endl "\n" #define int long long const int S=25001; int sum[S+2],fre[S+2],t,New[S+1]; void inc(int x){ for(int j=S;j>=x;j--){ sum[j]+=sum[j-x]; } return; } void dec(int x){ for(int j=0;j<=S-x;j++){ sum[j+x]-=sum[j]; } return; } signed main() { int n; cin>>n; int arr[n]; sum[0]=1; for(int i=0;i<n;i++){ cin>>arr[i]; inc(arr[i]); t+=arr[i]; } if(sum[t/2]==0){cout<<0<<endl;return 0;} for(int i=0;i<n;i++){ dec(arr[i]); t-=arr[i]; for(int j=0;j<=t-1;j++) { if((t-j)-j>0&&sum[j]!=0&&sum[(t-j)]!=0) fre[(t-j)-j]++; } t+=arr[i]; inc(arr[i]); } int siz=0; for(int j=1;j<=S;j++){ if(fre[j]==n) siz++; } cout<<siz<<endl; for(int j=1;j<=S;j++){ if(fre[j]==n) cout<<j<<" "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...