답안 #472777

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472777 2021-09-14T10:10:24 Z ogibogi2004 Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 452 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=512;
int n,a[MAXN],sum=0;
bitset<MAXN*MAXN>b1,b2,b3;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){cin>>a[i];sum+=a[i];}
    for(int i=0;i<MAXN*MAXN;i++)b1[i]=1;
    b2=0;
    b2[0]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=sum;j>=a[i];j--)
        {
            if(b2[j-a[i]]==1)b2[j]=1;
        }
    }
    b3=0;
    for(int i=0;i<=sum;i++)
    {
        if(b2[i]==0)continue;
        int t1=i,t2=sum-i;
        b3[abs(t1-t2)]=1;
    }
    if(b3[0]==0)
    {
        cout<<"0\n";
        return 0;
    }
    for(int rec=1;rec<=n;rec++)
    {
        sum-=a[rec];
        b2=0;
        b2[0]=1;
        for(int i=1;i<=n;i++)
        {
            if(i==rec)continue;
            for(int j=sum;j>=a[i];j--)
            {
                if(b2[j-a[i]])b2[j]=1;
            }
        }
        b3=0;
        for(int i=0;i<=sum;i++)
        {
            if(b2[i]==0)continue;
            int t1=i,t2=sum-i;
            b3[abs(t1-t2)]=1;
        }
        b1&=b3;
        sum+=a[rec];
        /*for(int i=1;i<MAXN*MAXN;i++)
        {
            if(b3[i]==1)cout<<i<<" ";
        }
        cout<<endl;*/
    }
    vector<int>ans;
    for(int i=1;i<MAXN*MAXN;i++)
    {
        if(b1[i]==1)ans.push_back(i);
    }
    cout<<ans.size()<<endl;
    for(auto xd:ans)
    {
        cout<<xd<<" ";
    }
    cout<<endl;
return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 324 KB Output is correct
19 Correct 2 ms 324 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 324 KB Output is correct
19 Correct 2 ms 324 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 26 ms 416 KB Output is correct
22 Correct 38 ms 412 KB Output is correct
23 Correct 13 ms 420 KB Output is correct
24 Correct 75 ms 408 KB Output is correct
25 Correct 119 ms 412 KB Output is correct
26 Correct 145 ms 412 KB Output is correct
27 Correct 112 ms 412 KB Output is correct
28 Correct 141 ms 332 KB Output is correct
29 Correct 128 ms 400 KB Output is correct
30 Correct 112 ms 404 KB Output is correct
31 Correct 146 ms 452 KB Output is correct
32 Correct 93 ms 412 KB Output is correct
33 Correct 114 ms 332 KB Output is correct
34 Correct 140 ms 332 KB Output is correct
35 Correct 125 ms 412 KB Output is correct
36 Correct 88 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 324 KB Output is correct
19 Correct 2 ms 324 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 26 ms 416 KB Output is correct
22 Correct 38 ms 412 KB Output is correct
23 Correct 13 ms 420 KB Output is correct
24 Correct 75 ms 408 KB Output is correct
25 Correct 119 ms 412 KB Output is correct
26 Correct 145 ms 412 KB Output is correct
27 Correct 112 ms 412 KB Output is correct
28 Correct 141 ms 332 KB Output is correct
29 Correct 128 ms 400 KB Output is correct
30 Correct 112 ms 404 KB Output is correct
31 Correct 146 ms 452 KB Output is correct
32 Correct 93 ms 412 KB Output is correct
33 Correct 114 ms 332 KB Output is correct
34 Correct 140 ms 332 KB Output is correct
35 Correct 125 ms 412 KB Output is correct
36 Correct 88 ms 412 KB Output is correct
37 Execution timed out 1080 ms 332 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 324 KB Output is correct
19 Correct 2 ms 324 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 26 ms 416 KB Output is correct
22 Correct 38 ms 412 KB Output is correct
23 Correct 13 ms 420 KB Output is correct
24 Correct 75 ms 408 KB Output is correct
25 Correct 119 ms 412 KB Output is correct
26 Correct 145 ms 412 KB Output is correct
27 Correct 112 ms 412 KB Output is correct
28 Correct 141 ms 332 KB Output is correct
29 Correct 128 ms 400 KB Output is correct
30 Correct 112 ms 404 KB Output is correct
31 Correct 146 ms 452 KB Output is correct
32 Correct 93 ms 412 KB Output is correct
33 Correct 114 ms 332 KB Output is correct
34 Correct 140 ms 332 KB Output is correct
35 Correct 125 ms 412 KB Output is correct
36 Correct 88 ms 412 KB Output is correct
37 Execution timed out 1080 ms 332 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 3 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 3 ms 324 KB Output is correct
19 Correct 2 ms 324 KB Output is correct
20 Correct 3 ms 332 KB Output is correct
21 Correct 26 ms 416 KB Output is correct
22 Correct 38 ms 412 KB Output is correct
23 Correct 13 ms 420 KB Output is correct
24 Correct 75 ms 408 KB Output is correct
25 Correct 119 ms 412 KB Output is correct
26 Correct 145 ms 412 KB Output is correct
27 Correct 112 ms 412 KB Output is correct
28 Correct 141 ms 332 KB Output is correct
29 Correct 128 ms 400 KB Output is correct
30 Correct 112 ms 404 KB Output is correct
31 Correct 146 ms 452 KB Output is correct
32 Correct 93 ms 412 KB Output is correct
33 Correct 114 ms 332 KB Output is correct
34 Correct 140 ms 332 KB Output is correct
35 Correct 125 ms 412 KB Output is correct
36 Correct 88 ms 412 KB Output is correct
37 Execution timed out 1080 ms 332 KB Time limit exceeded
38 Halted 0 ms 0 KB -