Submission #404355

#TimeUsernameProblemLanguageResultExecution timeMemory
404355fvogel499Bootfall (IZhO17_bootfall)C++14
44 / 100
1099 ms580 KiB
#include <iostream> #include <cmath> #include <vector> #include <bitset> #include <queue> #include <cstring> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <algorithm> using namespace std; #define pii pair<int, int> #define f first #define s second #define ll long long #define rint int32_t const int siz = 250001; rint main() { cin.tie(0); // ios_base::sync_with_stdio(0); int n; cin >> n; int raw [n]; for (int i = 0; i < n; i++) cin >> raw[i]; bitset<siz> globalPos(0); for (int i = 1; i < siz; i++) globalPos[i] = 1; bitset<siz> check(0); check[0] = 1; int checkSum = 0; for (int i = 0; i < n; i++) { check |= check<<raw[i]; checkSum += raw[i]; } if (checkSum%2 == 1 or check[checkSum/2] == 0) globalPos = bitset<siz>(0); for (int i = 0; i < n; i++) { bitset<siz> cur(0); cur[0] = 1; int locSum = 0; for (int j = 0; j < n; j++) if (i != j) { cur |= cur<<raw[j]; locSum += raw[j]; } bitset<siz> locPos(0); for (int j = 1; j < siz; j++) { if ((locSum+j)%2 == 0 and cur[(locSum+j)/2]) locPos[j] = 1; } globalPos &= locPos; } cout << globalPos.count() << endl; for (int i = 1; i < siz; i++) if (globalPos[i] == 1) cout << i << " "; int d = 0; d++; }
#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...