Submission #891191

#TimeUsernameProblemLanguageResultExecution timeMemory
891191sleepntsheepKpart (eJOI21_kpart)C++17
30 / 100
2029 ms720 KiB
#include <iostream> #include <bitset> #include <fstream> #include <iomanip> #include <cmath> #include <cassert> #include <cstring> #include <numeric> #include <vector> #include <algorithm> #include <deque> #include <set> #include <utility> #include <array> #include <complex> using namespace std; #define ALL(x) begin(x), end(x) #define ShinLena cin.tie(nullptr)->sync_with_stdio(false); void docase() { int n; cin >> n; vector<long long> a(n); vector<long long> b(n); for (auto &x : a) cin >> x; inclusive_scan(ALL(a), begin(b)); int c[n+1]; memset(c,0,sizeof c); for (int i = 0; i < n; ++i) { bitset<50001> bb = 1; auto sum = 0; for (int j = i; j < n; ++j) { sum += a[j]; bb = bb | (bb << a[j]); if (!(sum & 1) && bb[sum / 2]) { ++c[j-i+1]; } } } vector<int> z; for (auto i = 1; i <= n; ++i) if (c[i] == n - (i - 1)) z.push_back(i); cout << z.size() << '\n'; for (auto x : z) cout << x << ' '; cout << '\n'; } int main() { ShinLena; int T; cin >> T; while (T--) docase(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...