Submission #1280678

#TimeUsernameProblemLanguageResultExecution timeMemory
1280678kkkkkKpart (eJOI21_kpart)C++20
0 / 100
1950 ms572 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 11; const int inf = 1e9; int a[N]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T = 1; cin >> T; bitset < N > oh; while(T--){ int n; cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } vector < int > ans; for(int k = 1; k <= n; k++){ int ok = 1, l = 1, sum = 0; oh = 0; oh[0] = 1; for(int r = 1; r <= n; r++){ sum += a[r]; oh |= (oh << a[r]); if(r - l + 1 > k){ sum -= a[l]; oh >>= a[l]; l++; } if(k <= r && (sum % 2 == 1 || oh[sum / 2] == 0)) { ok = 0; break; } } if(ok) ans.push_back(k); } cout << ans.size() << ' '; for(int i: ans) cout << i << ' '; cout << '\n'; } } // hello karim nurbakyt sanzhar azamat congratulation europa asia america laplas
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...