Submission #878936

#TimeUsernameProblemLanguageResultExecution timeMemory
878936heeheeheehaawBootfall (IZhO17_bootfall)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; bitset<125005> dp; int v[505], sepoate[250005]; int main() { int n, sum = 0; cin>>n; for(int i = 1; i <= n; i++) cin>>v[i], sum += v[i]; for(int i = 1; i <= n; i++) { dp.reset(); sum -= v[i]; dp[0] = 1; for(int j = 1; j <= n; j++) { if(j == i) continue; dp = ((dp << v[j]) | dp); } int lim = sum / 2; for(int j = 0; j <= sum && j * 2 <= sum; j++) if(dp[j] == 1) sepoate[sum - 2 * j]++; sum += v[i]; } int lim = sum / 2, rez = 0; vector<int> aux; for(int i = 0; i <= sum; i++) if(sepoate[i] == n) rez++, aux.push_back(i); cout<<rez<<'\n'; for(auto it : aux) cout<<it<<" "; return 0; }

Compilation message (stderr)

bootfall.cpp: In function 'int main()':
bootfall.cpp:26:13: warning: unused variable 'lim' [-Wunused-variable]
   26 |         int lim = sum / 2;
      |             ^~~
bootfall.cpp:34:9: warning: unused variable 'lim' [-Wunused-variable]
   34 |     int lim = sum / 2, rez = 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...