Submission #630883

# Submission time Handle Problem Language Result Execution time Memory
630883 2022-08-17T09:57:52 Z ZsofiaKeresztely Kpart (eJOI21_kpart) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  int t, n, sum, op;
  cin >> t;
  vector<int> a;
  set<int> sums;
  vector<vector<map<int, bool> > > psbl;
  vector<bool> k;
  while (t--){
    cin >> n;
    a.resize(n);
    vector<vector<map<int, bool> > > psbl(n, vector<map<int, bool> >(n));
    k.assign(n+1, true);
    k[0] = false;
    k[1] = false;
    for (int i=0; i<n; i++){
      cin >> a[i];
    }
    for (int i=0; i<n; i++){
      psbl[i][i][0] = true;
      psbl[i][i][a[i]] = true;
      sum = a[i];
      for (int j=i+1; j<n; j++){
        for (auto x : psbl[i][j-1]){
          if (!x.second) continue;
          psbl[i][j][x.first] = true;
          if (x.first + a[j] <= 50000){
            psbl[i][j][x.first + a[j]] = true;
          }
        }
        sum += a[j];
        if (sum % 2 || !psbl[i][j][sum/2]){
          k[j-i+1] = false;
        }
      }
    }
    op = 0;
    for (int x : k){
      if (x){
        op++;
      }
    }
    cout << op << " ";
    for (int i=1; i<n+1; i++){
      if (k[i]){
        cout << i << " ";
      }
    }
    cout << "\n";
  }
  return 0;

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:53:11: error: expected '}' at end of input
   53 |   return 0;
      |           ^
Main.cpp:4:11: note: to match this '{'
    4 | int main(){
      |           ^