답안 #35218

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
35218 2017-11-19T05:20:01 Z dqhungdl Bootfall (IZhO17_bootfall) C++14
28 / 100
1000 ms 3376 KB
#include <bits/stdc++.h>
using namespace std;
 
int n,sum,a[505],C[250005];
bool f[250005];
vector<int> rs;
 
bool Special()
{
    if(sum%2==1)
        return false;
    f[0]=true;
    for(int i=1;i<=n;i++)
        for(int j=sum;j>=a[i];j--)
            f[j]|=f[j-a[i]];
    return f[sum/2];
}
 
void Check(int pos)
{
    for(int i=1;i<=sum-a[pos];i++)
        f[i]=false;
    for(int i=1;i<=n;i++)
        if(i!=pos)
            for(int j=sum-a[pos];j>=a[i];j--)
                f[j]|=f[j-a[i]];
    for(int i=0;i<(sum-a[pos]+1)/2;i++)
        if(f[i]==true)
            C[sum-a[pos]-2*i]++;
}
 
int main()
{
    //ios_base::sync_with_stdio(false);
    //freopen("TEST.INP","r",stdin);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(Special()==false)
    {
        cout<<0;
        return 0;
    }
    for(int i=1;i<=n;i++)
        Check(i);
    for(int i=1;i<=sum;i++)
        if(C[i]==n)
            rs.push_back(i);
    cout<<rs.size()<<"\n";
    for(int i=0;i<rs.size();i++)
        cout<<rs[i]<<' ';
}

Compilation message

bootfall.cpp: In function 'int main()':
bootfall.cpp:53:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<rs.size();i++)
                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3236 KB Output is correct
2 Correct 0 ms 3236 KB Output is correct
3 Correct 0 ms 3236 KB Output is correct
4 Correct 0 ms 3236 KB Output is correct
5 Correct 0 ms 3236 KB Output is correct
6 Correct 0 ms 3236 KB Output is correct
7 Correct 0 ms 3236 KB Output is correct
8 Correct 0 ms 3236 KB Output is correct
9 Correct 0 ms 3236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3236 KB Output is correct
2 Correct 0 ms 3236 KB Output is correct
3 Correct 0 ms 3236 KB Output is correct
4 Correct 0 ms 3236 KB Output is correct
5 Correct 0 ms 3236 KB Output is correct
6 Correct 0 ms 3236 KB Output is correct
7 Correct 0 ms 3236 KB Output is correct
8 Correct 0 ms 3236 KB Output is correct
9 Correct 0 ms 3236 KB Output is correct
10 Correct 0 ms 3236 KB Output is correct
11 Correct 0 ms 3236 KB Output is correct
12 Correct 0 ms 3236 KB Output is correct
13 Correct 0 ms 3236 KB Output is correct
14 Correct 0 ms 3236 KB Output is correct
15 Correct 0 ms 3236 KB Output is correct
16 Correct 0 ms 3236 KB Output is correct
17 Correct 0 ms 3236 KB Output is correct
18 Correct 0 ms 3236 KB Output is correct
19 Correct 0 ms 3236 KB Output is correct
20 Correct 0 ms 3236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3236 KB Output is correct
2 Correct 0 ms 3236 KB Output is correct
3 Correct 0 ms 3236 KB Output is correct
4 Correct 0 ms 3236 KB Output is correct
5 Correct 0 ms 3236 KB Output is correct
6 Correct 0 ms 3236 KB Output is correct
7 Correct 0 ms 3236 KB Output is correct
8 Correct 0 ms 3236 KB Output is correct
9 Correct 0 ms 3236 KB Output is correct
10 Correct 0 ms 3236 KB Output is correct
11 Correct 0 ms 3236 KB Output is correct
12 Correct 0 ms 3236 KB Output is correct
13 Correct 0 ms 3236 KB Output is correct
14 Correct 0 ms 3236 KB Output is correct
15 Correct 0 ms 3236 KB Output is correct
16 Correct 0 ms 3236 KB Output is correct
17 Correct 0 ms 3236 KB Output is correct
18 Correct 0 ms 3236 KB Output is correct
19 Correct 0 ms 3236 KB Output is correct
20 Correct 0 ms 3236 KB Output is correct
21 Correct 13 ms 3236 KB Output is correct
22 Correct 19 ms 3236 KB Output is correct
23 Correct 6 ms 3236 KB Output is correct
24 Correct 46 ms 3236 KB Output is correct
25 Correct 89 ms 3236 KB Output is correct
26 Correct 123 ms 3236 KB Output is correct
27 Correct 96 ms 3236 KB Output is correct
28 Correct 109 ms 3236 KB Output is correct
29 Correct 109 ms 3236 KB Output is correct
30 Correct 59 ms 3236 KB Output is correct
31 Correct 86 ms 3236 KB Output is correct
32 Correct 53 ms 3236 KB Output is correct
33 Correct 109 ms 3236 KB Output is correct
34 Correct 113 ms 3236 KB Output is correct
35 Correct 109 ms 3236 KB Output is correct
36 Correct 79 ms 3236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3236 KB Output is correct
2 Correct 0 ms 3236 KB Output is correct
3 Correct 0 ms 3236 KB Output is correct
4 Correct 0 ms 3236 KB Output is correct
5 Correct 0 ms 3236 KB Output is correct
6 Correct 0 ms 3236 KB Output is correct
7 Correct 0 ms 3236 KB Output is correct
8 Correct 0 ms 3236 KB Output is correct
9 Correct 0 ms 3236 KB Output is correct
10 Correct 0 ms 3236 KB Output is correct
11 Correct 0 ms 3236 KB Output is correct
12 Correct 0 ms 3236 KB Output is correct
13 Correct 0 ms 3236 KB Output is correct
14 Correct 0 ms 3236 KB Output is correct
15 Correct 0 ms 3236 KB Output is correct
16 Correct 0 ms 3236 KB Output is correct
17 Correct 0 ms 3236 KB Output is correct
18 Correct 0 ms 3236 KB Output is correct
19 Correct 0 ms 3236 KB Output is correct
20 Correct 0 ms 3236 KB Output is correct
21 Correct 13 ms 3236 KB Output is correct
22 Correct 19 ms 3236 KB Output is correct
23 Correct 6 ms 3236 KB Output is correct
24 Correct 46 ms 3236 KB Output is correct
25 Correct 89 ms 3236 KB Output is correct
26 Correct 123 ms 3236 KB Output is correct
27 Correct 96 ms 3236 KB Output is correct
28 Correct 109 ms 3236 KB Output is correct
29 Correct 109 ms 3236 KB Output is correct
30 Correct 59 ms 3236 KB Output is correct
31 Correct 86 ms 3236 KB Output is correct
32 Correct 53 ms 3236 KB Output is correct
33 Correct 109 ms 3236 KB Output is correct
34 Correct 113 ms 3236 KB Output is correct
35 Correct 109 ms 3236 KB Output is correct
36 Correct 79 ms 3236 KB Output is correct
37 Correct 876 ms 3376 KB Output is correct
38 Correct 896 ms 3376 KB Output is correct
39 Execution timed out 1000 ms 3236 KB Execution timed out
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3236 KB Output is correct
2 Correct 0 ms 3236 KB Output is correct
3 Correct 0 ms 3236 KB Output is correct
4 Correct 0 ms 3236 KB Output is correct
5 Correct 0 ms 3236 KB Output is correct
6 Correct 0 ms 3236 KB Output is correct
7 Correct 0 ms 3236 KB Output is correct
8 Correct 0 ms 3236 KB Output is correct
9 Correct 0 ms 3236 KB Output is correct
10 Correct 0 ms 3236 KB Output is correct
11 Correct 0 ms 3236 KB Output is correct
12 Correct 0 ms 3236 KB Output is correct
13 Correct 0 ms 3236 KB Output is correct
14 Correct 0 ms 3236 KB Output is correct
15 Correct 0 ms 3236 KB Output is correct
16 Correct 0 ms 3236 KB Output is correct
17 Correct 0 ms 3236 KB Output is correct
18 Correct 0 ms 3236 KB Output is correct
19 Correct 0 ms 3236 KB Output is correct
20 Correct 0 ms 3236 KB Output is correct
21 Correct 13 ms 3236 KB Output is correct
22 Correct 19 ms 3236 KB Output is correct
23 Correct 6 ms 3236 KB Output is correct
24 Correct 46 ms 3236 KB Output is correct
25 Correct 89 ms 3236 KB Output is correct
26 Correct 123 ms 3236 KB Output is correct
27 Correct 96 ms 3236 KB Output is correct
28 Correct 109 ms 3236 KB Output is correct
29 Correct 109 ms 3236 KB Output is correct
30 Correct 59 ms 3236 KB Output is correct
31 Correct 86 ms 3236 KB Output is correct
32 Correct 53 ms 3236 KB Output is correct
33 Correct 109 ms 3236 KB Output is correct
34 Correct 113 ms 3236 KB Output is correct
35 Correct 109 ms 3236 KB Output is correct
36 Correct 79 ms 3236 KB Output is correct
37 Correct 876 ms 3376 KB Output is correct
38 Correct 896 ms 3376 KB Output is correct
39 Execution timed out 1000 ms 3236 KB Execution timed out
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3236 KB Output is correct
2 Correct 0 ms 3236 KB Output is correct
3 Correct 0 ms 3236 KB Output is correct
4 Correct 0 ms 3236 KB Output is correct
5 Correct 0 ms 3236 KB Output is correct
6 Correct 0 ms 3236 KB Output is correct
7 Correct 0 ms 3236 KB Output is correct
8 Correct 0 ms 3236 KB Output is correct
9 Correct 0 ms 3236 KB Output is correct
10 Correct 0 ms 3236 KB Output is correct
11 Correct 0 ms 3236 KB Output is correct
12 Correct 0 ms 3236 KB Output is correct
13 Correct 0 ms 3236 KB Output is correct
14 Correct 0 ms 3236 KB Output is correct
15 Correct 0 ms 3236 KB Output is correct
16 Correct 0 ms 3236 KB Output is correct
17 Correct 0 ms 3236 KB Output is correct
18 Correct 0 ms 3236 KB Output is correct
19 Correct 0 ms 3236 KB Output is correct
20 Correct 0 ms 3236 KB Output is correct
21 Correct 13 ms 3236 KB Output is correct
22 Correct 19 ms 3236 KB Output is correct
23 Correct 6 ms 3236 KB Output is correct
24 Correct 46 ms 3236 KB Output is correct
25 Correct 89 ms 3236 KB Output is correct
26 Correct 123 ms 3236 KB Output is correct
27 Correct 96 ms 3236 KB Output is correct
28 Correct 109 ms 3236 KB Output is correct
29 Correct 109 ms 3236 KB Output is correct
30 Correct 59 ms 3236 KB Output is correct
31 Correct 86 ms 3236 KB Output is correct
32 Correct 53 ms 3236 KB Output is correct
33 Correct 109 ms 3236 KB Output is correct
34 Correct 113 ms 3236 KB Output is correct
35 Correct 109 ms 3236 KB Output is correct
36 Correct 79 ms 3236 KB Output is correct
37 Correct 876 ms 3376 KB Output is correct
38 Correct 896 ms 3376 KB Output is correct
39 Execution timed out 1000 ms 3236 KB Execution timed out
40 Halted 0 ms 0 KB -