| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1347721 | Faisal_Saqib | Kpart (eJOI21_kpart) | C++20 | 2094 ms | 484 KiB |
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
typedef long long ll;
bitset<100009> dp;
void solve()
{
int n;
cin>>n;
vector<int> a(n);
vector<int> pos(n);
for(int i=0;i<n;i++)
{
pos[i]=1;
cin>>a[i];
}
for(int i=0;i<n;i++)
{
dp.reset();
dp[0]=1;
int tot=0;
for(int j=i;j<n;j++)
{
dp|=(dp<<a[j]);
tot+=a[j];
if(tot%2==0 and dp[tot/2])
{
}
else{
pos[j-i]=0;
}
}
}
int cnt=0;
for(int i=0;i<n;i++)cnt+=pos[i];
cout<<cnt<<' ';
for(int j=0;j<n;j++)if(pos[j])cout<<j+1<<' ';
cout<<endl;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
{
solve();
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
