Submission #1008659

#TimeUsernameProblemLanguageResultExecution timeMemory
1008659m5588ohammedBootfall (IZhO17_bootfall)C++14
13 / 100
1 ms348 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 #define mod 1000000007 const int S=2501; int sum[S+2],fre[S+2],t,New[S+1]; void inc(int x){ memset(New,0,sizeof New); for(int j=x;j<=S;j++) New[j]=sum[j-x]; for(int j=1;j<=S;j++){ sum[j]+=New[j]; sum[j]%=mod; } sum[x]++; sum[x]%=mod; return; } void dec(int x){ sum[x]--; for(int j=1;j<=S-x;j++){ sum[j+x]-=sum[j]; sum[j+x]+=mod; sum[j+x]%=mod; } return; } signed main() { int n; cin>>n; int arr[n]; 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<=S;j++) { if((t-j)-j>0&&(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...