Submission #891618

# Submission time Handle Problem Language Result Execution time Memory
891618 2023-12-23T10:53:08 Z imarn Kpart (eJOI21_kpart) C++14
0 / 100
313 ms 596 KB
#include "bits/stdc++.h"
#define f first
#define s second
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define vi vector<int>
#define vvi vector<vi>
using namespace std;
void solve(){
    int n;cin>>n;
    int a[n+1];for(int i=1;i<=n;i++)cin>>a[i];
    int qs[n+1]={0};for(int i=1;i<=n;i++)qs[i]=qs[i-1]+a[i];
    bool vis[100001]={0};
    bool ch[n+1]={0};ch[1]=1;
    vis[0]=1;int cnt=0;
    for(int i=1;i<=n;i++){
        for(int j=100000;j>=0;j--)if(vis[j]&&j+a[i]<=100000)vis[j+a[i]]=1;
        for(int j=2;j<=i;j++){
            int x=qs[i]-qs[i-j];
            if(x&1&&!ch[j]){ch[j]=1;continue;}x>>=1;
            if(!(vis[x+qs[i-j]])&&!ch[j])ch[j]=1;
        }
    }for(int i=1;i<=n;i++)if(!ch[i])cnt++;cout<<cnt<<' ';
    for(int i=1;i<=n;i++)if(!ch[i])cout<<i<<' ';cout<<'\n';
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int t;cin>>t;while(t--)solve();
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:27:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   27 |     for(int i=1;i<=n;i++)if(!ch[i])cout<<i<<' ';cout<<'\n';
      |     ^~~
Main.cpp:27:49: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   27 |     for(int i=1;i<=n;i++)if(!ch[i])cout<<i<<' ';cout<<'\n';
      |                                                 ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 313 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -