Submission #1107486

# Submission time Handle Problem Language Result Execution time Memory
1107486 2024-11-01T09:37:56 Z vjudge1 Kpart (eJOI21_kpart) C++17
0 / 100
1173 ms 460 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nn "\n";
#define pb push_back
#define all(v) (v).begin() , (v).end()
const int N = 2e4+ 4;
int n , T , q , m ;
signed main(){
    ios_base::sync_with_stdio(0) , cin.tie(0);
    cin>> T;
    while(T--){
        cin>> n ;
        int a[n+1];
        set<int>st;
        for(int i=1 ; i <= n; i++){
            cin>> a[i];
        }
        map<int , int >us;
        for(int i =1 ; i <= n ; i++){
            for(int j = i ; j <= n;  j++){
                      vector<int>v;
                      int sum =0 ;
                for(int u = i ; u <= j ; u++){
                    v.pb(a[u]);
                    sum+=a[u];
                }
                int x = sum/2;
                sort(all(v));
                int ans =0 ;
                for(int i=  v.size() - 1 ; i >=  0 ; i--){
                    if(ans + v[i] <= x ){
                        ans+=v[i];
                    }
                    if(ans==x)break;
                }
                if(ans == x && sum %2 ==0){
                    us[v.size()]++;
                }
            }
        }
        vector<int>way;
        for(int i =1 ;i <= n ; i++){
            if(us[i]== n - i + 1 ){
                way.pb(i);
            }
        }
        cout << way.size()<< ' ';
        for(auto it:way)cout <<it << ' ';
        cout << nn
    }
}

# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1173 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -