# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
763961 |
2023-06-23T04:06:52 Z |
Cookie |
Kpart (eJOI21_kpart) |
C++14 |
|
2000 ms |
384 KB |
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
ifstream fin("VNOICUP.INP");
ofstream fout("VNOICUP.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const ld PI = 3.14159265359;
using u128 = __uint128_t;
const int mxn = 1e5 + 5, mxv = 1e5 + 5;
int a[mxn + 1], n;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int tt; cin >> tt;
while(tt--){
cin >> n;
bitset<mxv>bs;
for(int i = 1; i <= n; i++)cin >> a[i];
vt<int>res;
for(int len = 1; len <= n; len++){
bool ok = 1;
for(int j = 1; j + len - 1 <= n; j++){
bs.reset(); int sm = 0; bs[0] = 1;
for(int k = j; k <= j + len - 1; k++){
bs = bs | (bs << a[k]); sm += a[k];
}
if((sm & 1) || !bs[sm / 2]){
ok = 0; break;
}
}
if(ok)res.pb(len);
}
cout << sz(res) << " ";
for(auto i: res)cout << i << " ";
cout << "\n";
}
return(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
837 ms |
368 KB |
Output is correct |
2 |
Execution timed out |
2077 ms |
368 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2068 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |