Submission #538002

# Submission time Handle Problem Language Result Execution time Memory
538002 2022-03-16T02:35:41 Z rin_tohsaka Kpart (eJOI21_kpart) C++14
0 / 100
230 ms 50412 KB
#include <bits/stdc++.h>
using namespace std;
int k[1010], p[1005];
int dp[1010][50010],c;
int main(){
    cin>>c;
  	int n;
    for(int i = 0; i < c; i++){
        cin>>n;p[0] = 0;
        for (int i = 0; i < n; i++){
          cin>>k[i];
        }
        for (int i = 0; i < n; i++){
          p[i]=p[i-1]+k[i];
        }
        vector<bool> work(n, true);
        for (int i=0;i<n;i++){
            for (int x=0;x<k[i];++x){
              dp[i][x]=dp[i-1][x];
            } 
            for (int x=k[i];x<50010;++x){
              dp[i][x]=max(dp[i-1][x],dp[i-1][x-k[i]]);
            } 
            dp[i][k[i]] = i;
            for (int j = 0;j<i;++j){
                int po = p[i]-p[j - 1];
                if (po % 2==0) work[i+1-j] = false;
                else if (dp[i][po / 2] < j) work[i+1-j] = 0;
            }
        }
        int ans=0;
        for (int i = 0; i<n; i++){
            if (work[i])ans++;
        }
                
        cout << ans << " ";
        for (int i = 0; i<n; i++){
            if (work[i]){
                cout << i << " ";
            }
        }
        cout << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 6068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 13396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 230 ms 50412 KB Output isn't correct
2 Halted 0 ms 0 KB -