Submission #534112

# Submission time Handle Problem Language Result Execution time Memory
534112 2022-03-08T01:16:26 Z Deepesson Bootfall (IZhO17_bootfall) C++17
0 / 100
3 ms 412 KB
#include <bits/stdc++.h>
#define MAX 251000
typedef std::bitset<MAX> bits;
int main()
{
    int N;
    std::cin>>N;
    int array[N];for(auto&x:array)std::cin>>x;
    int t=0;
    {
        for(auto&x:array)t+=x;
        if(t&1){
            std::cout<<"0\n";
            return 0;
        }
        bits x = {};
        x[0]=1;
        for(int i=0;i!=N;++i){
            x|=x<<array[i];
        }
        if(!x[t/2]){
            std::cout<<"0\n";
            return 0;
        }
    }
    bits permite={};
    for(int i=0;i!=MAX;++i)permite[i]=1;
    for(int i=0;i!=N;++i){
        bits prod={};
        prod[0]=1;
        long long soma=0;
        for(int j=0;j!=N;++j){
            if(i==j)continue;
            soma+=array[j];
            prod|=prod<<array[j];
        }
        int meio = soma/2;
        permite&=prod>>meio;
    }
    std::vector<int> pode;
    for(int i=1;i!=MAX;++i){
        if(permite[i])pode.push_back(i);
    }
    std::cout<<pode.size()<<"\n";
    for(auto&x:pode){
        std::cout<<((x*2)-(array[0]&1))<<" ";
    }
    std::cout<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 3 ms 408 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 412 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 3 ms 408 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 412 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 3 ms 408 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 412 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 3 ms 408 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 412 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 3 ms 408 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 412 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 408 KB Output is correct
4 Correct 3 ms 408 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Correct 2 ms 332 KB Output is correct
7 Correct 2 ms 412 KB Output is correct
8 Correct 3 ms 412 KB Output is correct
9 Incorrect 2 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -